Closed
Description
Example:
const FOO: usize = 0;
fn bar() -> &'static usize {
&FOO
}
fn main() {
bar();
}
Get error:
rustc 1.17.0-nightly (b1e31766d 2017-03-03)
error: borrowed value does not live long enough
--> <anon>:5:6
|
5 | &FOO
| ^^^ does not live long enough
6 | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
No labels