]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / borrowck / borrowck-move-out-of-struct-with-dtor.mir.stderr
1 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
2   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:10:11
3    |
4 LL |     match (S {f:"foo".to_string()}) {
5    |           ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
6 LL |         //[mir]~^ ERROR [E0509]
7 LL |         S {f:_s} => {}
8    |              -- data moved here
9    |
10 note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
11   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:14
12    |
13 LL |         S {f:_s} => {}
14    |              ^^
15
16 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
17   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:20
18    |
19 LL |     let S {f:_s} = S {f:"foo".to_string()};
20    |              --    ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
21    |              |
22    |              data moved here
23    |
24 note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
25   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:14
26    |
27 LL |     let S {f:_s} = S {f:"foo".to_string()};
28    |              ^^
29
30 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
31   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19
32    |
33 LL | fn move_in_fn_arg(S {f:_s}: S) {
34    |                   ^^^^^--^
35    |                   |    |
36    |                   |    data moved here
37    |                   cannot move out of here
38    |
39 note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
40   --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:24
41    |
42 LL | fn move_in_fn_arg(S {f:_s}: S) {
43    |                        ^^
44
45 error: aborting due to 3 previous errors
46
47 For more information about this error, try `rustc --explain E0509`.