rustc/tests/ui/consts/promote_const_let.rs
2023-08-02 10:33:26 +02:00

11 lines
231 B
Rust

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
};
}