diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0383.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0383.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0383.md b/compiler/rustc_error_codes/src/error_codes/E0383.md new file mode 100644 index 000000000..fd2b0b08f --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0383.md @@ -0,0 +1,34 @@ +#### Note: this error code is no longer emitted by the compiler. + +This error occurs when an attempt is made to partially reinitialize a +structure that is currently uninitialized. + +For example, this can happen when a drop has taken place: + +```compile_fail +struct Foo { + a: u32, +} +impl Drop for Foo { + fn drop(&mut self) { /* ... */ } +} + +let mut x = Foo { a: 1 }; +drop(x); // `x` is now uninitialized +x.a = 2; // error, partial reinitialization of uninitialized structure `t` +``` + +This error can be fixed by fully reinitializing the structure in question: + +``` +struct Foo { + a: u32, +} +impl Drop for Foo { + fn drop(&mut self) { /* ... */ } +} + +let mut x = Foo { a: 1 }; +drop(x); +x = Foo { a: 2 }; +``` |