summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-unary-move.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-unary-move.rs')
-rw-r--r--tests/ui/borrowck/borrowck-unary-move.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-unary-move.rs b/tests/ui/borrowck/borrowck-unary-move.rs
new file mode 100644
index 000000000..3b4c0731f
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-unary-move.rs
@@ -0,0 +1,11 @@
+fn foo(x: Box<isize>) -> isize {
+ let y = &*x;
+ free(x); //~ ERROR cannot move out of `x` because it is borrowed
+ *y
+}
+
+fn free(_x: Box<isize>) {
+}
+
+fn main() {
+}