diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-08-13 14:17:06 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-08-13 14:17:06 +0530 |
| commit | 9d0bca42e0fc63af49072826cec462e25310bd9c (patch) | |
| tree | a50371e1275c719a04ee0a0559231fb622d9ddf3 | |
| parent | ea3cd022ef77d384cfef15460560f8cb86ac41e2 (diff) | |
| parent | 67c7fd710be56cf3ba5ca03b7291add856e73a8d (diff) | |
Rollup merge of #27699 - nathankleyn:diagnostics-383, r=Manishearth
This adds detailed diagnostics for `E0383`, 'partial reinitialization of uninitialized structure'. This is part of rust-lang/rust#24407. r? @Manishearth
| -rw-r--r-- | src/librustc_borrowck/diagnostics.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs index 850701e7046..0bc43952926 100644 --- a/src/librustc_borrowck/diagnostics.rs +++ b/src/librustc_borrowck/diagnostics.rs @@ -138,6 +138,27 @@ Book: https://doc.rust-lang.org/book/ownership.html "##, +E0383: r##" +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: + +``` +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: + +``` +let mut x = Foo { a: 1 }; +drop(x); +x = Foo { a: 2 }; +``` +"##, + E0384: r##" This error occurs when an attempt is made to reassign an immutable variable. For example: @@ -217,7 +238,6 @@ https://doc.rust-lang.org/std/cell/ } register_diagnostics! { - E0383, // partial reinitialization of uninitialized structure E0385, // {} in an aliasable location E0386, // {} in an immutable container E0388, // {} in a static location |
