Skip to content

Commit

Permalink
Auto merge of rust-lang#64938 - estebank:ice-ice-baby, r=matthewjasper
Browse files Browse the repository at this point in the history
Avoid ICE on ReFree region on where clause

Fix rust-lang#64855.
  • Loading branch information
bors committed Oct 3, 2019
2 parents cfb6d84 + de81565 commit 032a53a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustc_typeck/outlives/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand Down
5 changes: 5 additions & 0 deletions src/test/ui/associated-types/issue-64855-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// check-pass

pub struct Bar<'a>(&'a Self) where Self: ;

fn main() {}
8 changes: 8 additions & 0 deletions src/test/ui/associated-types/issue-64855.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions src/test/ui/associated-types/issue-64855.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 032a53a

Please sign in to comment.