rust/tests/ui/consts/promote_const_let.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
231 B
Rust
Raw Normal View History

fn main() {
let x: &'static u32 = {
let y = 42;
&y //~ ERROR does not live long enough
};
let x: &'static u32 = &{ //~ ERROR temporary value dropped while borrowed
let y = 42;
y
};
2018-11-20 05:28:24 -06:00
}