about summary refs log tree commit diff
path: root/tests/ui/moves/move-in-guard-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/moves/move-in-guard-1.rs')
-rw-r--r--tests/ui/moves/move-in-guard-1.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/moves/move-in-guard-1.rs b/tests/ui/moves/move-in-guard-1.rs
new file mode 100644
index 00000000000..36e39fea6af
--- /dev/null
+++ b/tests/ui/moves/move-in-guard-1.rs
@@ -0,0 +1,15 @@
+pub fn main() {
+
+
+    let x: Box<_> = Box::new(1);
+
+    let v = (1, 2);
+
+    match v {
+        (1, _) if take(x) => (),
+        (_, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+        _ => (),
+    }
+}
+
+fn take<T>(_: T) -> bool { false }