@@ -3,7 +3,8 @@ use crate::traits::query::type_op::{self, TypeOp, TypeOpOutput};
33use crate :: traits:: query:: NoSolution ;
44use crate :: traits:: ObligationCause ;
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 } )
@@ -105,10 +110,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
105110 tys : FxIndexSet < Ty < ' tcx > > ,
106111 ) -> Bounds < ' a , ' tcx > {
107112 tys. into_iter ( )
108- . map ( move |ty| {
109- let ty = self . resolve_vars_if_possible ( ty) ;
110- self . implied_outlives_bounds ( param_env, body_id, ty)
111- } )
113+ . map ( move |ty| self . implied_outlives_bounds ( param_env, body_id, ty) )
112114 . flatten ( )
113115 }
114116}
0 commit comments