5
5
use infer:: at:: At ;
6
6
use infer:: canonical:: OriginalQueryValues ;
7
7
use infer:: { InferCtxt , InferOk } ;
8
- use mir:: interpret:: { ConstValue , GlobalId } ;
8
+ use mir:: interpret:: GlobalId ;
9
9
use traits:: project:: Normalized ;
10
10
use traits:: { Obligation , ObligationCause , PredicateObligation , Reveal } ;
11
11
use ty:: fold:: { TypeFoldable , TypeFolder } ;
@@ -188,8 +188,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
188
188
}
189
189
}
190
190
191
- fn fold_const ( & mut self , constant : & ' tcx ty:: Const < ' tcx > ) -> & ' tcx ty:: Const < ' tcx > {
192
- if let ConstValue :: Unevaluated ( def_id, substs) = constant. val {
191
+ fn fold_const ( & mut self , constant : & ' tcx ty:: LazyConst < ' tcx > ) -> & ' tcx ty:: LazyConst < ' tcx > {
192
+ if let ty :: LazyConst :: Unevaluated ( def_id, substs) = * constant {
193
193
let tcx = self . infcx . tcx . global_tcx ( ) ;
194
194
if let Some ( param_env) = self . tcx ( ) . lift_to_global ( & self . param_env ) {
195
195
if substs. needs_infer ( ) || substs. has_placeholders ( ) {
@@ -201,8 +201,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
201
201
promoted : None ,
202
202
} ;
203
203
if let Ok ( evaluated) = tcx. const_eval ( param_env. and ( cid) ) {
204
- let evaluated = evaluated. subst ( self . tcx ( ) , substs) ;
205
- return self . fold_const ( evaluated) ;
204
+ let substs = tcx. lift_to_global ( & substs) . unwrap ( ) ;
205
+ let evaluated = evaluated. subst ( tcx, substs) ;
206
+ return tcx. intern_lazy_const ( ty:: LazyConst :: Evaluated ( evaluated) ) ;
206
207
}
207
208
}
208
209
} else {
@@ -214,7 +215,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
214
215
promoted : None ,
215
216
} ;
216
217
if let Ok ( evaluated) = tcx. const_eval ( param_env. and ( cid) ) {
217
- return self . fold_const ( evaluated)
218
+ return tcx . intern_lazy_const ( ty :: LazyConst :: Evaluated ( evaluated) ) ;
218
219
}
219
220
}
220
221
}
0 commit comments