Skip to content

Commit dd175fe

Browse files
committed
cycle_participants to nested_goals
1 parent e38109d commit dd175fe

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

compiler/rustc_next_trait_solver/src/solve/search_graph.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct StackEntry<I: Interner> {
7171
/// C :- D
7272
/// D :- C
7373
/// ```
74-
cycle_participants: HashSet<CanonicalInput<I>>,
74+
nested_goals: HashSet<CanonicalInput<I>>,
7575
/// Starts out as `None` and gets set when rerunning this
7676
/// goal in case we encounter a cycle.
7777
provisional_result: Option<QueryResult<I>>,
@@ -215,8 +215,8 @@ impl<I: Interner> SearchGraph<I> {
215215
let current_cycle_root = &mut stack[current_root.as_usize()];
216216
for entry in cycle_participants {
217217
entry.non_root_cycle_participant = entry.non_root_cycle_participant.max(Some(head));
218-
current_cycle_root.cycle_participants.insert(entry.input);
219-
current_cycle_root.cycle_participants.extend(mem::take(&mut entry.cycle_participants));
218+
current_cycle_root.nested_goals.insert(entry.input);
219+
current_cycle_root.nested_goals.extend(mem::take(&mut entry.nested_goals));
220220
}
221221
}
222222

@@ -335,7 +335,7 @@ impl<I: Interner> SearchGraph<I> {
335335
non_root_cycle_participant: None,
336336
encountered_overflow: false,
337337
has_been_used: HasBeenUsed::empty(),
338-
cycle_participants: Default::default(),
338+
nested_goals: Default::default(),
339339
provisional_result: None,
340340
};
341341
assert_eq!(self.stack.push(entry), depth);
@@ -389,15 +389,15 @@ impl<I: Interner> SearchGraph<I> {
389389
//
390390
// We must not use the global cache entry of a root goal if a cycle
391391
// participant is on the stack. This is necessary to prevent unstable
392-
// results. See the comment of `StackEntry::cycle_participants` for
392+
// results. See the comment of `StackEntry::nested_goals` for
393393
// more details.
394394
self.global_cache(cx).insert(
395395
cx,
396396
input,
397397
proof_tree,
398398
reached_depth,
399399
final_entry.encountered_overflow,
400-
final_entry.cycle_participants,
400+
final_entry.nested_goals,
401401
dep_node,
402402
result,
403403
)
@@ -544,27 +544,27 @@ impl<I: Interner> SearchGraph<I> {
544544
non_root_cycle_participant,
545545
encountered_overflow: _,
546546
has_been_used,
547-
ref cycle_participants,
547+
ref nested_goals,
548548
provisional_result,
549549
} = *entry;
550550
let cache_entry = provisional_cache.get(&entry.input).unwrap();
551551
assert_eq!(cache_entry.stack_depth, Some(depth));
552552
if let Some(head) = non_root_cycle_participant {
553553
assert!(head < depth);
554-
assert!(cycle_participants.is_empty());
554+
assert!(nested_goals.is_empty());
555555
assert_ne!(stack[head].has_been_used, HasBeenUsed::empty());
556556

557557
let mut current_root = head;
558558
while let Some(parent) = stack[current_root].non_root_cycle_participant {
559559
current_root = parent;
560560
}
561-
assert!(stack[current_root].cycle_participants.contains(&input));
561+
assert!(stack[current_root].nested_goals.contains(&input));
562562
}
563563

564-
if !cycle_participants.is_empty() {
564+
if !nested_goals.is_empty() {
565565
assert!(provisional_result.is_some() || !has_been_used.is_empty());
566566
for entry in stack.iter().take(depth.as_usize()) {
567-
assert_eq!(cycle_participants.get(&entry.input), None);
567+
assert_eq!(nested_goals.get(&entry.input), None);
568568
}
569569
}
570570
}

0 commit comments

Comments
 (0)