Auto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper
Avoid ICE on ReFree region on where clause Fix #64855.
This commit is contained in:
commit
032a53a06c
4 changed files with 29 additions and 2 deletions
|
|
@ -161,9 +161,14 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
|
|||
// ignore it. We can't put it on the struct header anyway.
|
||||
RegionKind::ReLateBound(..) => false,
|
||||
|
||||
// This can appear in `where Self: ` bounds (#64855):
|
||||
//
|
||||
// struct Bar<T>(<Self as Foo>::Type) where Self: ;
|
||||
// struct Baz<'a>(&'a Self) where Self: ;
|
||||
RegionKind::ReEmpty => false,
|
||||
|
||||
// These regions don't appear in types from type declarations:
|
||||
RegionKind::ReEmpty
|
||||
| RegionKind::ReErased
|
||||
RegionKind::ReErased
|
||||
| RegionKind::ReClosureBound(..)
|
||||
| RegionKind::ReScope(..)
|
||||
| RegionKind::ReVar(..)
|
||||
|
|
|
|||
5
src/test/ui/associated-types/issue-64855-2.rs
Normal file
5
src/test/ui/associated-types/issue-64855-2.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
pub struct Bar<'a>(&'a Self) where Self: ;
|
||||
|
||||
fn main() {}
|
||||
8
src/test/ui/associated-types/issue-64855.rs
Normal file
8
src/test/ui/associated-types/issue-64855.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
pub trait Foo {
|
||||
type Type;
|
||||
}
|
||||
|
||||
pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
|
||||
//~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/associated-types/issue-64855.stderr
Normal file
9
src/test/ui/associated-types/issue-64855.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
|
||||
--> $DIR/issue-64855.rs:5:19
|
||||
|
|
||||
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue