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