fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.4 KiB34 linesraw
1error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
2  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:7:11
3   |
4LL |     match (S {f:"foo".to_string()}) {
5   |           ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
6LL |
7LL |         S {f:_s} => {}
8   |              --
9   |              |
10   |              data moved here
11   |              move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
12
13error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
14  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:14:20
15   |
16LL |     let S {f:_s} = S {f:"foo".to_string()};
17   |              --    ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
18   |              |
19   |              data moved here
20   |              move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
21
22error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
23  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:19
24   |
25LL | fn move_in_fn_arg(S {f:_s}: S) {
26   |                   ^^^^^--^
27   |                   |    |
28   |                   |    data moved here
29   |                   |    move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
30   |                   cannot move out of here
31
32error: aborting due to 3 previous errors
33
34For more information about this error, try `rustc --explain E0509`.