]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
Rollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett
[rust.git] / src / test / ui / borrowck / borrowck-move-out-of-struct-with-dtor.rs
1 struct S {f:String}
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".to_string()}) {
8         //~^ ERROR [E0509]
9         S {f:_s} => {}
10     }
11 }
12
13 fn move_in_let() {
14     let S {f:_s} = S {f:"foo".to_string()};
15     //~^ ERROR [E0509]
16 }
17
18 fn move_in_fn_arg(S {f:_s}: S) {
19     //~^ ERROR [E0509]
20 }
21
22 fn main() {}