reserve variable for empty root region

This commit is contained in:
Niko Matsakis 2020-04-09 10:55:27 +00:00
parent 771fdd9985
commit b8caef423d
14 changed files with 176 additions and 123 deletions

View file

@ -34,7 +34,7 @@ LL | | (a, b)
LL | | }
| |_^
|
= note: hidden type `(&u8, &u8)` captures lifetime '_#4r
= note: hidden type `(&u8, &u8)` captures lifetime '_#5r
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ret-impl-trait-no-fg.rs:9:1
@ -48,7 +48,7 @@ LL | | (a, b)
LL | | }
| |_^
|
= note: hidden type `(&u8, &u8)` captures lifetime '_#5r
= note: hidden type `(&u8, &u8)` captures lifetime '_#6r
error: aborting due to 5 previous errors

View file

@ -2,7 +2,7 @@ error: higher-ranked subtype error
--> $DIR/due-to-where-clause.rs:2:5
|
LL | test::<FooS>(&mut 42);
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
| ^^^^^^^^^^^^^^^^^^
|
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
= note: hidden type `Ordinary<'_>` captures lifetime '_#9r
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
| ^^^^^^^^^^^^^^^^^^
|
= note: hidden type `Ordinary<'_>` captures lifetime '_#5r
= note: hidden type `Ordinary<'_>` captures lifetime '_#6r
error: aborting due to previous error

View file

@ -0,0 +1,15 @@
// Regression test for issue #68550.
//
// The `&'static A:` where clause was triggering
// ICEs because it wound up being compiled to reference
// the `'empty(U0)` region.
fn run<'a, A>(x: A)
where
A: 'static,
&'static A: ,
{
let _: &'a A = &x; //~ ERROR `x` does not live long enough
}
fn main() {}

View file

@ -0,0 +1,16 @@
error[E0597]: `x` does not live long enough
--> $DIR/issue-68550.rs:12:20
|
LL | fn run<'a, A>(x: A)
| -- lifetime `'a` defined here
...
LL | let _: &'a A = &x;
| ----- ^^ borrowed value does not live long enough
| |
| type annotation requires that `x` is borrowed for `'a`
LL | }
| - `x` dropped here while still borrowed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.