Skip to content
Draft
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
19 changes: 16 additions & 3 deletions compiler/rustc_borrowck/src/type_check/free_region_relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,19 +572,32 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
debug!("add_outlives_bounds(bound={:?})", outlives_bound);

match outlives_bound {
OutlivesBound::RegionSubRegion(r1, r2) => {
OutlivesBound::RegionSubRegion(ra, rb) => {
// The bound says that `r1 <= r2`; we store `r2: r1`.
let r1 = self.universal_regions.to_region_vid(r1);
let r2 = self.universal_regions.to_region_vid(r2);
let r1 = self.universal_regions.to_region_vid(ra);
let r2 = self.universal_regions.to_region_vid(rb);
if !(self.universal_regions.is_universal_region(r1)
|| self.universal_regions.is_universal_region(r2))
{
assert!(false, "case one: {} <= {}", ra, rb);
}
Comment on lines +577 to +583

@tiif tiif Aug 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I noticed I missed the case where r1 xor r2 is non-universal region, I will open a follow-up PR with crater run that only includes this case that I missed.

View changes since the review

@tiif tiif Aug 30, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't any case in our test suite where r1 xor r2 is non-universal region, I guess we can just safely ignore it?

self.relate_universal_regions(r2, r1);
}

OutlivesBound::RegionSubParam(r_a, param_b) => {
let r1 = self.universal_regions.to_region_vid(r_a);
if !self.universal_regions.is_universal_region(r1) {
assert!(false, "case two: {} <= {}", r_a, param_b);
}
self.region_bound_pairs
.insert(ty::OutlivesClause(GenericKind::Param(param_b), r_a));
}

OutlivesBound::RegionSubAlias(r_a, alias_b) => {
let r1 = self.universal_regions.to_region_vid(r_a);
if !self.universal_regions.is_universal_region(r1) {
assert!(false, "case three: {} <= {}", r_a, alias_b);
}
self.region_bound_pairs
.insert(ty::OutlivesClause(GenericKind::Alias(alias_b), r_a));
}
Expand Down
Loading