]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs
auto merge of #11461 : alexcrichton/rust/rustdoc-fixes, r=brson
[rust.git] / src / test / compile-fail / borrowck-move-out-of-struct-with-dtor.rs
1 struct S {f:~str}
2 impl Drop for S {
3     fn drop(&mut self) { println!("{}", self.f); }
4 }
5
6 fn move_in_match() {
7     match S {f:~"foo"} {
8         S {f:_s} => {}
9         //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
10     }
11 }
12
13 fn move_in_let() {
14     let S {f:_s} = S {f:~"foo"};
15     //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
16 }
17
18 fn move_in_fn_arg(S {f:_s}: S) {
19     //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
20 }
21
22 fn main() {}