@@ -3,7 +3,8 @@ use crate::traits::query::type_op::{self, TypeOp, TypeOpOutput};
3
3
use crate :: traits:: query:: NoSolution ;
4
4
use crate :: traits:: { ObligationCause , ObligationCtxt } ;
5
5
use 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 } ;
7
8
use rustc_span:: def_id:: LocalDefId ;
8
9
9
10
pub use rustc_middle:: traits:: query:: OutlivesBound ;
@@ -52,6 +53,10 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
52
53
body_id : LocalDefId ,
53
54
ty : Ty < ' tcx > ,
54
55
) -> 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
+
55
60
let span = self . tcx . def_span ( body_id) ;
56
61
let result = param_env
57
62
. and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds { ty } )
@@ -106,10 +111,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
106
111
tys : FxIndexSet < Ty < ' tcx > > ,
107
112
) -> Bounds < ' a , ' tcx > {
108
113
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) )
113
115
. flatten ( )
114
116
}
115
117
}
0 commit comments