@@ -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 }
@@ -802,10 +802,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
802802 }
803803
804804 fn fold_const ( & mut self , ct : & ' tcx ty:: Const < ' tcx > ) -> & ' tcx ty:: Const < ' tcx > {
805- if let ty:: Const {
806- val : ConstValue :: Infer ( ty:: InferConst :: Canonical ( debruijn, bound_const) ) ,
807- ty,
808- } = * ct {
805+ if let ty:: Const { val : ConstValue :: Bound ( debruijn, bound_ct) , ty } = * ct {
809806 if self . amount == 0 || debruijn < self . current_index {
810807 ct
811808 } else {
@@ -816,7 +813,10 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
816813 debruijn. shifted_out ( self . amount )
817814 }
818815 } ;
819- self . tcx . mk_const_infer ( ty:: InferConst :: Canonical ( debruijn, bound_const) , ty)
816+ self . tcx . mk_const ( ty:: Const {
817+ val : ConstValue :: Bound ( debruijn, bound_ct) ,
818+ ty,
819+ } )
820820 }
821821 } else {
822822 ct. super_fold_with ( self )
@@ -920,8 +920,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
920920 // const, as it has types/regions embedded in a lot of other
921921 // places.
922922 match ct. val {
923- ConstValue :: Infer ( ty:: InferConst :: Canonical ( debruijn, _) )
924- if debruijn >= self . outer_index => true ,
923+ ConstValue :: Bound ( debruijn, _) if debruijn >= self . outer_index => true ,
925924 _ => ct. super_visit_with ( self ) ,
926925 }
927926 }
0 commit comments