add a test that we enforce 'static errors post normalization
This commit is contained in:
parent
820c2657f2
commit
16b3ea1e2e
2 changed files with 26 additions and 0 deletions
13
src/test/ui/nll/user-annotations/normalization.rs
Normal file
13
src/test/ui/nll/user-annotations/normalization.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Test that we enforce a `&'static` requirement that is only visible
|
||||
// after normalization.
|
||||
|
||||
#![feature(nll)]
|
||||
#![ignore(unused)]
|
||||
|
||||
trait Foo { type Out; }
|
||||
impl Foo for () { type Out = &'static u32; }
|
||||
|
||||
fn main() {
|
||||
let a = 22;
|
||||
let b: <() as Foo>::Out = &a; //~ ERROR
|
||||
}
|
||||
13
src/test/ui/nll/user-annotations/normalization.stderr
Normal file
13
src/test/ui/nll/user-annotations/normalization.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/normalization.rs:12:31
|
||||
|
|
||||
LL | let b: <() as Foo>::Out = &a; //~ ERROR
|
||||
| ^^ borrowed value does not live long enough
|
||||
LL | }
|
||||
| - `a` dropped here while still borrowed
|
||||
|
|
||||
= note: borrowed value must be valid for the static lifetime...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue