Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions compiler/rustc_type_ir/src/search_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,25 @@ impl<X: Cx> NestedGoals<X> {
/// to all nested goals of that nested goal are also inductive. Otherwise the paths are
/// the same as for the child.
fn extend_from_child(&mut self, step_kind: PathKind, nested_goals: &NestedGoals<X>) {
// Each nested goal is updated independently, and `insert` only unions paths for that
// goal, so traversal order cannot affect the result.
#[allow(rustc::potential_query_instability)]
for (input, paths_to_nested) in nested_goals.iter() {
let paths_to_nested = paths_to_nested.extend_with(step_kind);
self.insert(input, paths_to_nested);
if nested_goals.is_empty() {
return;
}

// Each nested goal is updated independently, so traversal order cannot
// affect the result.
#[expect(rustc::potential_query_instability)]
if self.is_empty() {
// Manually avoid HashMap lookups for every input if there aren't
// any preexisting entries.
self.nested_goals.clone_from(&nested_goals.nested_goals);
for paths_to_nested in self.nested_goals.values_mut() {
*paths_to_nested = paths_to_nested.extend_with(step_kind);
}
} else {
for (input, paths_to_nested) in nested_goals.iter() {
let paths_to_nested = paths_to_nested.extend_with(step_kind);
self.insert(input, paths_to_nested);
}
}
}

Expand Down
Loading