rust/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
2018-12-25 21:08:33 -07:00

19 lines
657 B
Plaintext

error[E0597]: borrowed value does not live long enough
--> $DIR/borrowck-borrow-from-temporary.rs:9:24
|
LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough
| ^^^^^^^^^^ temporary value does not live long enough
LL | x
LL | }
| - temporary value only lives until here
|
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 8:8...
--> $DIR/borrowck-borrow-from-temporary.rs:8:8
|
LL | fn foo<'a>() -> &'a isize {
| ^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.