Skip to content

Commit 2751b86

Browse files
committed
Don't try to lower ReEmpty in NLL
1 parent c57ed9d commit 2751b86

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs

+7
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
334334

335335
match outlives_bound {
336336
OutlivesBound::RegionSubRegion(r1, r2) => {
337+
// `where Type:` is lowered to `where Type: 'empty` so that
338+
// we check `Type` is well formed, but there's no use for
339+
// this bound here.
340+
if let ty::ReEmpty = r1 {
341+
return;
342+
}
343+
337344
// The bound says that `r1 <= r2`; we store `r2: r1`.
338345
let r1 = self.universal_regions.to_region_vid(r1);
339346
let r2 = self.universal_regions.to_region_vid(r2);
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Regression test for #61315
2+
//
3+
// `dyn T:` is lowered to `dyn T: ReEmpty` - check that we don't ICE in NLL for
4+
// the unexpected region.
5+
6+
// compile-pass
7+
8+
trait T {}
9+
fn f() where dyn T: {}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)