Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions compiler/rustc_type_ir/src/region_constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,10 @@ fn pull_region_outlives_constraints_out_of_universe<
constraint
}
RegionOutlives(region_1, region_2, ()) => {
if region_1 == region_2 {
return RegionConstraint::new_true();
}

let region_1_u = max_universe(infcx, region_1);
let region_2_u = max_universe(infcx, region_2);

Expand Down
29 changes: 29 additions & 0 deletions tests/ui/assumptions_on_binders/identity_region_outlives.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//@ compile-flags: -Zassumptions-on-binders
//@ check-pass

// Regression test for #161733.
// Previously we didn't properly handle identity region outlives
// and it was mistakenly considered as false region constraint.
// The closure is needed to register the type outlives obligation
// in borrowck.

#![feature(test_binder_constraints)]

fn foo<T>()
where
for<'a> &'a T: 'a,
{
|| {};
}

core::test_binder_constraints! {
impl<T> {
forall<'a> where T: 'a {
'a: 'a,
T: 'a,
} expect {
}
}
}

fn main() {}
Loading