From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/consts/promote_const_let.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/ui/consts/promote_const_let.rs (limited to 'tests/ui/consts/promote_const_let.rs') 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 + }; +} -- cgit v1.2.3