fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.8 KiB49 linesraw
1error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
2  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:9: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 `String`, which does not implement the `Copy` trait
12   |
13help: consider borrowing the pattern binding
14   |
15LL |         S {f:ref _s} => {}
16   |              +++
17
18error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
19  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:16:20
20   |
21LL |     let S {f:_s} = S {f:"foo".to_string()};
22   |              --    ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
23   |              |
24   |              data moved here
25   |              move occurs because `_s` has type `String`, which does not implement the `Copy` trait
26   |
27help: consider borrowing the pattern binding
28   |
29LL |     let S {f:ref _s} = S {f:"foo".to_string()};
30   |              +++
31
32error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
33  --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:19
34   |
35LL | fn move_in_fn_arg(S {f:_s}: S) {
36   |                   ^^^^^--^
37   |                   |    |
38   |                   |    data moved here
39   |                   |    move occurs because `_s` has type `String`, which does not implement the `Copy` trait
40   |                   cannot move out of here
41   |
42help: consider borrowing the pattern binding
43   |
44LL | fn move_in_fn_arg(S {f:ref _s}: S) {
45   |                        +++
46
47error: aborting due to 3 previous errors
48
49For more information about this error, try `rustc --explain E0509`.