diff options
Diffstat (limited to 'tests/ui/consts/promote_const_let.rs')
-rw-r--r-- | tests/ui/consts/promote_const_let.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/consts/promote_const_let.rs b/tests/ui/consts/promote_const_let.rs new file mode 100644 index 000000000..51a0fec2e --- /dev/null +++ b/tests/ui/consts/promote_const_let.rs @@ -0,0 +1,10 @@ +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 + }; +} |