Skip to content

Commit de936c7

Browse files
committed
move & rename strucural init tests
changes are seperate so git will recognize as a move
1 parent f6901c8 commit de936c7

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
error[E0381]: assigned binding `d` isn't fully initialized
2+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5
3+
|
4+
LL | let d: D;
5+
| - binding declared here but left uninitialized
6+
LL | d.x = 10;
7+
| ^^^^^^^^ `d` assigned here but it isn't fully initialized
8+
|
9+
= help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit`
10+
11+
error[E0381]: assigned binding `d` isn't fully initialized
12+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:33:5
13+
|
14+
LL | let mut d: D;
15+
| ----- binding declared here but left uninitialized
16+
LL | d.x = 10;
17+
| ^^^^^^^^ `d` assigned here but it isn't fully initialized
18+
|
19+
= help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit`
20+
21+
error[E0382]: assign of moved value: `d`
22+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:39:5
23+
|
24+
LL | let mut d = D { x: 0, s: S{ y: 0, z: 0 } };
25+
| ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
26+
LL | drop(d);
27+
| - value moved here
28+
LL | d.x = 10;
29+
| ^^^^^^^^ value assigned here after move
30+
31+
error[E0381]: partially assigned binding `d` isn't fully initialized
32+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:45:5
33+
|
34+
LL | let d: D;
35+
| - binding declared here but left uninitialized
36+
LL | d.s.y = 20;
37+
| ^^^^^^^^^^ `d.s` partially assigned here but it isn't fully initialized
38+
|
39+
= help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit`
40+
41+
error[E0381]: partially assigned binding `d` isn't fully initialized
42+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:50:5
43+
|
44+
LL | let mut d: D;
45+
| ----- binding declared here but left uninitialized
46+
LL | d.s.y = 20;
47+
| ^^^^^^^^^^ `d.s` partially assigned here but it isn't fully initialized
48+
|
49+
= help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit`
50+
51+
error[E0382]: assign to part of moved value: `d`
52+
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:56:5
53+
|
54+
LL | let mut d = D { x: 0, s: S{ y: 0, z: 0} };
55+
| ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait
56+
LL | drop(d);
57+
| - value moved here
58+
LL | d.s.y = 20;
59+
| ^^^^^^^^^^ value partially assigned here after move
60+
61+
error: aborting due to 6 previous errors
62+
63+
Some errors have detailed explanations: E0381, E0382.
64+
For more information about an error, try `rustc --explain E0381`.

0 commit comments

Comments
 (0)