Open
Description
The output of this test ...
// compile-flags: -Znll-dump-cause
#![feature(nll)]
#![allow(warnings)]
fn gimme(x: &(u32,)) -> &u32 {
&x.0
}
fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
let v = 22;
gimme(&(v,))
//~^ ERROR borrowed value does not live long enough [E0597]
}
fn main() {}
is not great
[santiago@archlinux rust1 (borrowed_value_error)]$ rustc +stage1 src/test/ui/nll/borrowed-universal-error.rs -Znll-dump-cause
error[E0597]: borrowed value does not live long enough
--> src/test/ui/nll/borrowed-universal-error.rs:22:12
|
22 | gimme(&(v,))
| ^^^^ temporary value does not live long enough
23 | //~^ ERROR borrowed value does not live long enough [E0597]
24 | }
| - temporary value only lives until here
|
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:1...
--> src/test/ui/nll/borrowed-universal-error.rs:20:1
|
20 | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
If you want more information on this error, try using "rustc --explain E0597"