Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 912981a

Browse files
committedMay 22, 2025·
Auto merge of #141396 - matthiaskrgr:rollup-feg050g, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #135562 (Add ignore value suggestion in closure body) - #139635 (Finalize repeat expr inference behaviour with inferred repeat counts) - #139668 (Handle regions equivalent to 'static in non_local_bounds) - #140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths) - #140435 (use uX::from instead of _ as uX in non - const contexts) - #141130 (rustc_on_unimplemented cleanups) - #141286 (Querify `coroutine_hidden_types`) Failed merges: - #140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2eef478 + 8c25082 commit 912981a

File tree

88 files changed

+1685
-988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1685
-988
lines changed
 

‎compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ impl UniversalRegionRelations<'_> {
131131
assert!(self.universal_regions.is_universal_region(fr0));
132132

133133
let mut external_parents = vec![];
134-
let mut queue = vec![fr0];
134+
135+
let mut queue = vec![relation.minimal_scc_representative(fr0)];
135136

136137
// Keep expanding `fr` into its parents until we reach
137138
// non-local regions.

‎compiler/rustc_data_structures/src/transitive_relation.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,20 @@ impl<T: Eq + Hash + Copy> TransitiveRelation<T> {
354354
.collect()
355355
}
356356

357+
/// Given an element A, elements B with the lowest index such that `A R B`
358+
/// and `B R A`, or `A` if no such element exists.
359+
pub fn minimal_scc_representative(&self, a: T) -> T {
360+
match self.index(a) {
361+
Some(a_i) => self.with_closure(|closure| {
362+
closure
363+
.iter(a_i.0)
364+
.find(|i| closure.contains(*i, a_i.0))
365+
.map_or(a, |i| self.elements[i])
366+
}),
367+
None => a,
368+
}
369+
}
370+
357371
fn with_closure<OP, R>(&self, op: OP) -> R
358372
where
359373
OP: FnOnce(&BitMatrix<usize, usize>) -> R,

0 commit comments

Comments
 (0)
Please sign in to comment.