File tree 2 files changed +33
-8
lines changed
compiler/rustc_trait_selection/src
2 files changed +33
-8
lines changed Original file line number Diff line number Diff line change 12
12
13
13
#![ doc( html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/" ) ]
14
14
#![ doc( rust_logo) ]
15
- #![ feature( rustdoc_internals) ]
16
15
#![ allow( internal_features) ]
17
16
#![ allow( rustc:: diagnostic_outside_of_impl) ]
18
17
#![ allow( rustc:: untranslatable_diagnostic) ]
19
18
#![ feature( assert_matches) ]
20
19
#![ feature( associated_type_defaults) ]
21
20
#![ feature( box_patterns) ]
22
21
#![ feature( control_flow_enum) ]
22
+ #![ feature( coroutines) ]
23
23
#![ feature( extract_if) ]
24
24
#![ feature( if_let_guard) ]
25
+ #![ feature( iter_from_coroutine) ]
25
26
#![ feature( let_chains) ]
26
- #![ feature( option_take_if) ]
27
27
#![ feature( never_type) ]
28
+ #![ feature( option_take_if) ]
29
+ #![ feature( rustdoc_internals) ]
28
30
#![ feature( type_alias_impl_trait) ]
29
31
#![ recursion_limit = "512" ] // For rustdoc
30
32
Original file line number Diff line number Diff line change @@ -216,6 +216,34 @@ impl<'tcx> WipGoalEvaluationStep<'tcx> {
216
216
}
217
217
inspect:: GoalEvaluationStep { instantiated_goal : self . instantiated_goal , evaluation }
218
218
}
219
+
220
+ // Returns all added goals from this scope and all containing scopes.
221
+ fn all_added_goals (
222
+ & self ,
223
+ ) -> impl Iterator < Item = ( GoalSource , Goal < ' tcx , ty:: Predicate < ' tcx > > ) > + ' _ {
224
+ std:: iter:: from_coroutine (
225
+ #[ coroutine]
226
+ || {
227
+ let mut current = & self . evaluation ;
228
+ for i in 0 .. {
229
+ for step in & current. steps {
230
+ if let WipProbeStep :: AddGoal ( source, goal) = * step {
231
+ yield ( source, goal) ;
232
+ }
233
+ }
234
+
235
+ if i < self . probe_depth {
236
+ let Some ( WipProbeStep :: NestedProbe ( p) ) = current. steps . last ( ) else {
237
+ bug ! ( ) ;
238
+ } ;
239
+ current = p;
240
+ } else {
241
+ break ;
242
+ }
243
+ }
244
+ } ,
245
+ )
246
+ }
219
247
}
220
248
221
249
#[ derive( Eq , PartialEq , Debug ) ]
@@ -530,12 +558,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
530
558
) {
531
559
match self . as_mut ( ) {
532
560
Some ( DebugSolver :: GoalEvaluationStep ( state) ) => {
533
- let added_goals = infcx. tcx . mk_nested_goals_from_iter (
534
- state. current_evaluation_scope ( ) . steps . iter ( ) . filter_map ( |step| match * step {
535
- WipProbeStep :: AddGoal ( source, goal) => Some ( ( source, goal) ) ,
536
- _ => None ,
537
- } ) ,
538
- ) ;
561
+ let added_goals = infcx. tcx . mk_nested_goals_from_iter ( state. all_added_goals ( ) ) ;
539
562
let added_goals = canonical:: make_canonical_state (
540
563
infcx,
541
564
& state. var_values ,
You can’t perform that action at this time.
0 commit comments