Skip to content

Commit 032a53a

Browse files
committed
Auto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper
Avoid ICE on ReFree region on where clause Fix #64855.
2 parents cfb6d84 + de81565 commit 032a53a

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/librustc_typeck/outlives/utils.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,14 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
161161
// ignore it. We can't put it on the struct header anyway.
162162
RegionKind::ReLateBound(..) => false,
163163

164+
// This can appear in `where Self: ` bounds (#64855):
165+
//
166+
// struct Bar<T>(<Self as Foo>::Type) where Self: ;
167+
// struct Baz<'a>(&'a Self) where Self: ;
168+
RegionKind::ReEmpty => false,
169+
164170
// These regions don't appear in types from type declarations:
165-
RegionKind::ReEmpty
166-
| RegionKind::ReErased
171+
RegionKind::ReErased
167172
| RegionKind::ReClosureBound(..)
168173
| RegionKind::ReScope(..)
169174
| RegionKind::ReVar(..)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// check-pass
2+
3+
pub struct Bar<'a>(&'a Self) where Self: ;
4+
5+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pub trait Foo {
2+
type Type;
3+
}
4+
5+
pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
6+
//~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
2+
--> $DIR/issue-64855.rs:5:19
3+
|
4+
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
5+
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)