@@ -13,7 +13,7 @@ use rustc_infer::infer::TyCtxtInferExt;
1313use rustc_middle:: mir:: interpret:: { CTFE_ALLOC_SALT , read_target_uint, write_target_uint} ;
1414use rustc_middle:: mir:: { self , BinOp , ConstValue , NonDivergingIntrinsic } ;
1515use rustc_middle:: ty:: layout:: TyAndLayout ;
16- use rustc_middle:: ty:: { FloatTy , PolyExistentialPredicate , Ty , TyCtxt , TypeFoldable } ;
16+ use rustc_middle:: ty:: { FloatTy , PolyExistentialPredicate , Ty , TyCtxt } ;
1717use rustc_middle:: { bug, span_bug, ty} ;
1818use rustc_span:: { Symbol , sym} ;
1919use rustc_trait_selection:: traits:: { Obligation , ObligationCause , ObligationCtxt } ;
@@ -243,13 +243,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
243243 ocx. register_obligations ( preds. iter ( ) . map ( |pred : PolyExistentialPredicate < ' _ > | {
244244 let pred = pred. with_self_ty ( tcx, tp_ty) ;
245245 // Lifetimes can only be 'static because of the bound on T
246- let pred = pred. fold_with ( & mut ty:: BottomUpFolder {
247- tcx,
248- ty_op : |ty| ty,
249- lt_op : |lt| {
250- if lt == tcx. lifetimes . re_erased { tcx. lifetimes . re_static } else { lt }
251- } ,
252- ct_op : |ct| ct,
246+ let pred = ty:: fold_regions ( tcx, pred, |r, _| {
247+ if r == tcx. lifetimes . re_erased { tcx. lifetimes . re_static } else { r }
253248 } ) ;
254249 Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, pred)
255250 } ) ) ;
0 commit comments