fork/rust

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

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

master
1.9 KiB51 linesraw
1error[E0382]: use of moved value: `x`
2  --> $DIR/union-move.rs:29:18
3   |
4LL | fn test1(x: U1) {
5   |          - move occurs because `x` has type `U1`, which does not implement the `Copy` trait
6...
7LL |         move_out(x.f1_nocopy);
8   |                  ----------- value moved here
9LL |         move_out(x.f2_nocopy);
10   |                  ^^^^^^^^^^^ value used here after move
11   |
12note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
13  --> $DIR/union-move.rs:10:19
14   |
15LL | fn move_out<T>(x: T) {}
16   |    --------       ^ this parameter takes ownership of the value
17   |    |
18   |    in this function
19
20error[E0382]: use of moved value: `x`
21  --> $DIR/union-move.rs:45:18
22   |
23LL | fn test3(x: U1) {
24   |          - move occurs because `x` has type `U1`, which does not implement the `Copy` trait
25...
26LL |         move_out(x.f2_nocopy);
27   |                  ----------- value moved here
28LL |         move_out(x.f3_copy);
29   |                  ^^^^^^^^^ value used here after move
30   |
31note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
32  --> $DIR/union-move.rs:10:19
33   |
34LL | fn move_out<T>(x: T) {}
35   |    --------       ^ this parameter takes ownership of the value
36   |    |
37   |    in this function
38
39error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait
40  --> $DIR/union-move.rs:52:18
41   |
42LL |         move_out(x.f1_nocopy);
43   |                  ^^^^^^^^^^^
44   |                  |
45   |                  cannot move out of here
46   |                  move occurs because `x.f1_nocopy` has type `ManuallyDrop<RefCell<i32>>`, which does not implement the `Copy` trait
47
48error: aborting due to 3 previous errors
49
50Some errors have detailed explanations: E0382, E0509.
51For more information about an error, try `rustc --explain E0382`.