Skip to content

Commit 16b3ea1

Browse files
committed
add a test that we enforce 'static errors post normalization
1 parent 820c265 commit 16b3ea1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Test that we enforce a `&'static` requirement that is only visible
2+
// after normalization.
3+
4+
#![feature(nll)]
5+
#![ignore(unused)]
6+
7+
trait Foo { type Out; }
8+
impl Foo for () { type Out = &'static u32; }
9+
10+
fn main() {
11+
let a = 22;
12+
let b: <() as Foo>::Out = &a; //~ ERROR
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0597]: `a` does not live long enough
2+
--> $DIR/normalization.rs:12:31
3+
|
4+
LL | let b: <() as Foo>::Out = &a; //~ ERROR
5+
| ^^ borrowed value does not live long enough
6+
LL | }
7+
| - `a` dropped here while still borrowed
8+
|
9+
= note: borrowed value must be valid for the static lifetime...
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0597`.

0 commit comments

Comments
 (0)