11use  crate :: infer:: InferCtxt ; 
2- use  crate :: traits:: query:: type_op:: { self ,  TypeOp ,  TypeOpOutput } ; 
32use  crate :: traits:: { ObligationCause ,  ObligationCtxt } ; 
43use  rustc_data_structures:: fx:: FxIndexSet ; 
5- use  rustc_errors:: ErrorGuaranteed ; 
64use  rustc_infer:: infer:: resolve:: OpportunisticRegionResolver ; 
5+ use  rustc_infer:: infer:: InferOk ; 
6+ use  rustc_middle:: infer:: canonical:: { OriginalQueryValues ,  QueryRegionConstraints } ; 
77use  rustc_middle:: ty:: { self ,  ParamEnv ,  Ty ,  TypeFolder ,  TypeVisitableExt } ; 
88use  rustc_span:: def_id:: LocalDefId ; 
99
@@ -68,20 +68,29 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
6868            return  vec ! [ ] ; 
6969        } 
7070
71-         let  span = self . tcx . def_span ( body_id) ; 
72-         let  result:  Result < _ ,  ErrorGuaranteed >  = param_env
73-             . and ( type_op:: implied_outlives_bounds:: ImpliedOutlivesBounds  {  ty } ) 
74-             . fully_perform ( self ,  span) ; 
75-         let  result = match  result { 
76-             Ok ( r)  => r, 
77-             Err ( _)  => { 
78-                 return  vec ! [ ] ; 
79-             } 
71+         let  mut  canonical_var_values = OriginalQueryValues :: default ( ) ; 
72+         let  canonical_ty =
73+             self . canonicalize_query_keep_static ( param_env. and ( ty) ,  & mut  canonical_var_values) ; 
74+         let  Ok ( canonical_result)  = self . tcx . implied_outlives_bounds ( canonical_ty)  else  { 
75+             return  vec ! [ ] ; 
76+         } ; 
77+ 
78+         let  mut  constraints = QueryRegionConstraints :: default ( ) ; 
79+         let  Ok ( InferOk  {  value,  obligations } )  = self 
80+             . instantiate_nll_query_response_and_region_obligations ( 
81+                 & ObligationCause :: dummy ( ) , 
82+                 param_env, 
83+                 & canonical_var_values, 
84+                 canonical_result, 
85+                 & mut  constraints, 
86+             )  else  { 
87+             return  vec ! [ ] ; 
8088        } ; 
89+         assert_eq ! ( & obligations,  & [ ] ) ; 
8190
82-         let  TypeOpOutput  {  output,  constraints,  .. }  = result; 
91+         if  !constraints. is_empty ( )  { 
92+             let  span = self . tcx . def_span ( body_id) ; 
8393
84-         if  let  Some ( constraints)  = constraints { 
8594            debug ! ( ?constraints) ; 
8695            if  !constraints. member_constraints . is_empty ( )  { 
8796                span_bug ! ( span,  "{:#?}" ,  constraints. member_constraints) ; 
@@ -108,7 +117,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
108117            } 
109118        } ; 
110119
111-         output 
120+         value 
112121    } 
113122
114123    fn  implied_bounds_tys ( 
0 commit comments