fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.7 KiB48 linesraw
1error[E0381]: assign of possibly-uninitialized variable: `d`
2  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5
3   |
4LL |     d.x = 10;
5   |     ^^^^^^^^ use of possibly-uninitialized `d`
6
7error[E0381]: assign of possibly-uninitialized variable: `d`
8  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:34:5
9   |
10LL |     d.x = 10;
11   |     ^^^^^^^^ use of possibly-uninitialized `d`
12
13error[E0382]: assign of moved value: `d`
14  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:41:5
15   |
16LL |     let mut d = D { x: 0, s: S{ y: 0, z: 0 } };
17   |         ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
18LL |     drop(d);
19   |          - value moved here
20LL |     d.x = 10;
21   |     ^^^^^^^^ value assigned here after move
22
23error[E0381]: assign to part of possibly-uninitialized variable: `d`
24  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:47:5
25   |
26LL |     d.s.y = 20;
27   |     ^^^^^^^^^^ use of possibly-uninitialized `d.s`
28
29error[E0381]: assign to part of possibly-uninitialized variable: `d`
30  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:53:5
31   |
32LL |     d.s.y = 20;
33   |     ^^^^^^^^^^ use of possibly-uninitialized `d.s`
34
35error[E0382]: assign to part of moved value: `d`
36  --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:60:5
37   |
38LL |     let mut d = D { x: 0, s: S{ y: 0, z: 0} };
39   |         ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
40LL |     drop(d);
41   |          - value moved here
42LL |     d.s.y = 20;
43   |     ^^^^^^^^^^ value partially assigned here after move
44
45error: aborting due to 6 previous errors
46
47Some errors have detailed explanations: E0381, E0382.
48For more information about an error, try `rustc --explain E0381`.