@@ -521,10 +521,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> {
521
521
}
522
522
523
523
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 {
528
525
if debruijn == self . current_index {
529
526
let fld_c = & mut self . fld_c ;
530
527
let ct = fld_c ( bound_const, ty) ;
@@ -570,7 +567,10 @@ impl<'tcx> TyCtxt<'tcx> {
570
567
// identity for bound types and consts
571
568
let fld_t = |bound_ty| self . mk_ty ( ty:: Bound ( ty:: INNERMOST , bound_ty) ) ;
572
569
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
+ } )
574
574
} ;
575
575
self . replace_escaping_bound_vars ( value. skip_binder ( ) , fld_r, fld_t, fld_c)
576
576
}
@@ -802,10 +802,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
802
802
}
803
803
804
804
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 {
809
806
if self . amount == 0 || debruijn < self . current_index {
810
807
ct
811
808
} else {
@@ -816,7 +813,10 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
816
813
debruijn. shifted_out ( self . amount )
817
814
}
818
815
} ;
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
+ } )
820
820
}
821
821
} else {
822
822
ct. super_fold_with ( self )
@@ -920,8 +920,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
920
920
// const, as it has types/regions embedded in a lot of other
921
921
// places.
922
922
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 ,
925
924
_ => ct. super_visit_with ( self ) ,
926
925
}
927
926
}
0 commit comments