summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs')
-rw-r--r--tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
new file mode 100644
index 000000000..93183062d
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
@@ -0,0 +1,24 @@
+// run-rustfix
+#![allow(unused)]
+struct S {f:String}
+impl Drop for S {
+ fn drop(&mut self) { println!("{}", self.f); }
+}
+
+fn move_in_match() {
+ match (S {f:"foo".to_string()}) {
+ //~^ ERROR [E0509]
+ S {f:_s} => {}
+ }
+}
+
+fn move_in_let() {
+ let S {f:_s} = S {f:"foo".to_string()};
+ //~^ ERROR [E0509]
+}
+
+fn move_in_fn_arg(S {f:_s}: S) {
+ //~^ ERROR [E0509]
+}
+
+fn main() {}