about summary refs log tree commit diff
path: root/tests/ui/span/borrowck-ref-into-rvalue.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/span/borrowck-ref-into-rvalue.rs')
-rw-r--r--tests/ui/span/borrowck-ref-into-rvalue.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/span/borrowck-ref-into-rvalue.rs b/tests/ui/span/borrowck-ref-into-rvalue.rs
new file mode 100644
index 00000000000..7b09fad927f
--- /dev/null
+++ b/tests/ui/span/borrowck-ref-into-rvalue.rs
@@ -0,0 +1,12 @@
+// run-rustfix
+fn main() {
+    let msg;
+    match Some("Hello".to_string()) {
+        //~^ ERROR temporary value dropped while borrowed
+        Some(ref m) => {
+            msg = m;
+        },
+        None => { panic!() }
+    }
+    println!("{}", *msg);
+}