@@ -3,7 +3,8 @@ use crate::traits::query::type_op::{self, TypeOp, TypeOpOutput};
33use crate :: traits:: query:: NoSolution ;
44use crate :: traits:: { ObligationCause , ObligationCtxt } ;
55use rustc_data_structures:: fx:: FxIndexSet ;
6- use rustc_middle:: ty:: { self , ParamEnv , Ty } ;
6+ use rustc_infer:: infer:: resolve:: OpportunisticRegionResolver ;
7+ use rustc_middle:: ty:: { self , ParamEnv , Ty , TypeFolder , TypeVisitableExt } ;
78use rustc_span:: def_id:: LocalDefId ;
89
910pub use rustc_middle:: traits:: query:: OutlivesBound ;
@@ -52,6 +53,10 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
5253 body_id : LocalDefId ,
5354 ty : Ty < ' tcx > ,
5455 ) -> Vec < OutlivesBound < ' tcx > > {
56+ let ty = self . resolve_vars_if_possible ( ty) ;
57+ let ty = OpportunisticRegionResolver :: new ( self ) . fold_ty ( ty) ;
58+ assert ! ( !ty. needs_infer( ) ) ;
59+
5560 let span = self . tcx . def_span ( body_id) ;
5661 let result = param_env
5762 . and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds { ty } )
@@ -106,10 +111,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
106111 tys : FxIndexSet < Ty < ' tcx > > ,
107112 ) -> Bounds < ' a , ' tcx > {
108113 tys. into_iter ( )
109- . map ( move |ty| {
110- let ty = self . resolve_vars_if_possible ( ty) ;
111- self . implied_outlives_bounds ( param_env, body_id, ty)
112- } )
114+ . map ( move |ty| self . implied_outlives_bounds ( param_env, body_id, ty) )
113115 . flatten ( )
114116 }
115117}
0 commit comments