55use infer:: at:: At ;
66use infer:: canonical:: OriginalQueryValues ;
77use infer:: { InferCtxt , InferOk } ;
8- use mir:: interpret:: { ConstValue , GlobalId } ;
8+ use mir:: interpret:: GlobalId ;
99use traits:: project:: Normalized ;
1010use traits:: { Obligation , ObligationCause , PredicateObligation , Reveal } ;
1111use ty:: fold:: { TypeFoldable , TypeFolder } ;
@@ -188,8 +188,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
188188 }
189189 }
190190
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 {
193193 let tcx = self . infcx . tcx . global_tcx ( ) ;
194194 if let Some ( param_env) = self . tcx ( ) . lift_to_global ( & self . param_env ) {
195195 if substs. needs_infer ( ) || substs. has_placeholders ( ) {
@@ -201,8 +201,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
201201 promoted : None ,
202202 } ;
203203 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) ) ;
206207 }
207208 }
208209 } else {
@@ -214,7 +215,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
214215 promoted : None ,
215216 } ;
216217 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) ) ;
218219 }
219220 }
220221 }
0 commit comments