@@ -521,10 +521,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> {
521521 }
522522
523523 fn fold_const ( & mut self , ct : & ' tcx ty:: Const < ' tcx > ) -> & ' tcx ty:: Const < ' tcx > {
524- if let ty:: Const {
525- val : ConstValue :: Infer ( ty:: InferConst :: Canonical ( debruijn, bound_const) ) ,
526- ty,
527- } = * ct {
524+ if let ty:: Const { val : ConstValue :: Bound ( debruijn, bound_const) , ty } = * ct {
528525 if debruijn == self . current_index {
529526 let fld_c = & mut self . fld_c ;
530527 let ct = fld_c ( bound_const, ty) ;
@@ -570,7 +567,10 @@ impl<'tcx> TyCtxt<'tcx> {
570567 // identity for bound types and consts
571568 let fld_t = |bound_ty| self . mk_ty ( ty:: Bound ( ty:: INNERMOST , bound_ty) ) ;
572569 let fld_c = |bound_ct, ty| {
573- self . mk_const_infer ( ty:: InferConst :: Canonical ( ty:: INNERMOST , bound_ct) , ty)
570+ self . mk_const ( ty:: Const {
571+ val : ConstValue :: Bound ( ty:: INNERMOST , bound_ct) ,
572+ ty,
573+ } )
574574 } ;
575575 self . replace_escaping_bound_vars ( value. skip_binder ( ) , fld_r, fld_t, fld_c)
576576 }
@@ -801,10 +801,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
801801 }
802802
803803 fn fold_const ( & mut self , ct : & ' tcx ty:: Const < ' tcx > ) -> & ' tcx ty:: Const < ' tcx > {
804- if let ty:: Const {
805- val : ConstValue :: Infer ( ty:: InferConst :: Canonical ( debruijn, bound_const) ) ,
806- ty,
807- } = * ct {
804+ if let ty:: Const { val : ConstValue :: Bound ( debruijn, bound_ct) , ty } = * ct {
808805 if self . amount == 0 || debruijn < self . current_index {
809806 ct
810807 } else {
@@ -815,7 +812,10 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
815812 debruijn. shifted_out ( self . amount )
816813 }
817814 } ;
818- self . tcx . mk_const_infer ( ty:: InferConst :: Canonical ( debruijn, bound_const) , ty)
815+ self . tcx . mk_const ( ty:: Const {
816+ val : ConstValue :: Bound ( debruijn, bound_ct) ,
817+ ty,
818+ } )
819819 }
820820 } else {
821821 ct. super_fold_with ( self )
@@ -919,8 +919,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
919919 // const, as it has types/regions embedded in a lot of other
920920 // places.
921921 match ct. val {
922- ConstValue :: Infer ( ty:: InferConst :: Canonical ( debruijn, _) )
923- if debruijn >= self . outer_index => true ,
922+ ConstValue :: Bound ( debruijn, _) if debruijn >= self . outer_index => true ,
924923 _ => ct. super_visit_with ( self ) ,
925924 }
926925 }
0 commit comments