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