diff options
| author | bors <bors@rust-lang.org> | 2019-10-03 16:14:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-03 16:14:32 +0000 |
| commit | 032a53a06ce293571e51bbe621a5c480e8a28e95 (patch) | |
| tree | 079d966a9b4e34a6aca5a19055caba5ca21d15f7 /src | |
| parent | cfb6d84720019236e33872e145d187dfd6e81090 (diff) | |
| parent | de815653eda51093d31a41ada7041f48d7417866 (diff) | |
| download | rust-032a53a06ce293571e51bbe621a5c480e8a28e95.tar.gz rust-032a53a06ce293571e51bbe621a5c480e8a28e95.zip | |
Auto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper
Avoid ICE on ReFree region on where clause Fix #64855.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/outlives/utils.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-64855-2.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-64855.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-64855.stderr | 9 |
4 files changed, 29 insertions, 2 deletions
diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index d83c97b522c..d34605dc482 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -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(..) diff --git a/src/test/ui/associated-types/issue-64855-2.rs b/src/test/ui/associated-types/issue-64855-2.rs new file mode 100644 index 00000000000..1d53bd57031 --- /dev/null +++ b/src/test/ui/associated-types/issue-64855-2.rs @@ -0,0 +1,5 @@ +// check-pass + +pub struct Bar<'a>(&'a Self) where Self: ; + +fn main() {} diff --git a/src/test/ui/associated-types/issue-64855.rs b/src/test/ui/associated-types/issue-64855.rs new file mode 100644 index 00000000000..81cf3ae6e83 --- /dev/null +++ b/src/test/ui/associated-types/issue-64855.rs @@ -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() {} diff --git a/src/test/ui/associated-types/issue-64855.stderr b/src/test/ui/associated-types/issue-64855.stderr new file mode 100644 index 00000000000..6ad795c1117 --- /dev/null +++ b/src/test/ui/associated-types/issue-64855.stderr @@ -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`. |
