]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | #### Note: this error code is no longer emitted by the compiler. |
2 | ||
3 | This error occurs when an attempt is made to partially reinitialize a | |
4 | structure that is currently uninitialized. | |
5 | ||
6 | For example, this can happen when a drop has taken place: | |
7 | ||
8 | ```compile_fail | |
9 | struct Foo { | |
10 | a: u32, | |
11 | } | |
12 | impl Drop for Foo { | |
13 | fn drop(&mut self) { /* ... */ } | |
14 | } | |
15 | ||
16 | let mut x = Foo { a: 1 }; | |
17 | drop(x); // `x` is now uninitialized | |
18 | x.a = 2; // error, partial reinitialization of uninitialized structure `t` | |
19 | ``` | |
20 | ||
21 | This error can be fixed by fully reinitializing the structure in question: | |
22 | ||
23 | ``` | |
24 | struct Foo { | |
25 | a: u32, | |
26 | } | |
27 | impl Drop for Foo { | |
28 | fn drop(&mut self) { /* ... */ } | |
29 | } | |
30 | ||
31 | let mut x = Foo { a: 1 }; | |
32 | drop(x); | |
33 | x = Foo { a: 2 }; | |
34 | ``` |