@@ -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
}
@@ -801,10 +801,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
801
801
}
802
802
803
803
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 {
808
805
if self . amount == 0 || debruijn < self . current_index {
809
806
ct
810
807
} else {
@@ -815,7 +812,10 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
815
812
debruijn. shifted_out ( self . amount )
816
813
}
817
814
} ;
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
+ } )
819
819
}
820
820
} else {
821
821
ct. super_fold_with ( self )
@@ -919,8 +919,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
919
919
// const, as it has types/regions embedded in a lot of other
920
920
// places.
921
921
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 ,
924
923
_ => ct. super_visit_with ( self ) ,
925
924
}
926
925
}
0 commit comments