File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
src/test/ui/nll/user-annotations Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments