@@ -70,17 +70,16 @@ pub trait InferCtxtEvalExt<'tcx> {
70
70
fn evaluate_root_goal (
71
71
& self ,
72
72
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
73
- ) -> Result < ( bool , Certainty ) , NoSolution > ;
73
+ ) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty :: Predicate < ' tcx > > > ) , NoSolution > ;
74
74
}
75
75
76
76
impl < ' tcx > InferCtxtEvalExt < ' tcx > for InferCtxt < ' tcx > {
77
77
#[ instrument( level = "debug" , skip( self ) ) ]
78
78
fn evaluate_root_goal (
79
79
& self ,
80
80
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
81
- ) -> Result < ( bool , Certainty ) , NoSolution > {
81
+ ) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty :: Predicate < ' tcx > > > ) , NoSolution > {
82
82
let mode = if self . intercrate { SolverMode :: Coherence } else { SolverMode :: Normal } ;
83
-
84
83
let mut search_graph = search_graph:: SearchGraph :: new ( self . tcx , mode) ;
85
84
86
85
let mut ecx = EvalCtxt {
@@ -152,13 +151,13 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
152
151
& mut self ,
153
152
is_normalizes_to_hack : IsNormalizesToHack ,
154
153
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
155
- ) -> Result < ( bool , Certainty ) , NoSolution > {
154
+ ) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty :: Predicate < ' tcx > > > ) , NoSolution > {
156
155
let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
157
156
let canonical_response =
158
157
EvalCtxt :: evaluate_canonical_goal ( self . tcx ( ) , self . search_graph , canonical_goal) ?;
159
158
160
159
let has_changed = !canonical_response. value . var_values . is_identity ( ) ;
161
- let certainty = self . instantiate_and_apply_query_response (
160
+ let ( certainty, nested_goals ) = self . instantiate_and_apply_query_response (
162
161
goal. param_env ,
163
162
orig_values,
164
163
canonical_response,
@@ -186,7 +185,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
186
185
assert_eq ! ( certainty, canonical_response. value. certainty) ;
187
186
}
188
187
189
- Ok ( ( has_changed, certainty) )
188
+ Ok ( ( has_changed, certainty, nested_goals ) )
190
189
}
191
190
192
191
fn compute_goal ( & mut self , goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ) -> QueryResult < ' tcx > {
@@ -263,13 +262,14 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
263
262
let mut has_changed = Err ( Certainty :: Yes ) ;
264
263
265
264
if let Some ( goal) = goals. normalizes_to_hack_goal . take ( ) {
266
- let ( _, certainty) = match this. evaluate_goal (
265
+ let ( _, certainty, nested_goals ) = match this. evaluate_goal (
267
266
IsNormalizesToHack :: Yes ,
268
267
goal. with ( this. tcx ( ) , ty:: Binder :: dummy ( goal. predicate ) ) ,
269
268
) {
270
269
Ok ( r) => r,
271
270
Err ( NoSolution ) => return Some ( Err ( NoSolution ) ) ,
272
271
} ;
272
+ new_goals. goals . extend ( nested_goals) ;
273
273
274
274
if goal. predicate . projection_ty
275
275
!= this. resolve_vars_if_possible ( goal. predicate . projection_ty )
@@ -308,11 +308,12 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
308
308
}
309
309
310
310
for nested_goal in goals. goals . drain ( ..) {
311
- let ( changed, certainty) =
311
+ let ( changed, certainty, nested_goals ) =
312
312
match this. evaluate_goal ( IsNormalizesToHack :: No , nested_goal) {
313
313
Ok ( result) => result,
314
314
Err ( NoSolution ) => return Some ( Err ( NoSolution ) ) ,
315
315
} ;
316
+ new_goals. goals . extend ( nested_goals) ;
316
317
317
318
if changed {
318
319
has_changed = Ok ( ( ) ) ;
0 commit comments