Kevin Butler
|
32d0dbd49a
|
librustc: Forbid partial reinitialization of uninitialized structures or
enumerations that implement the `Drop` trait.
This breaks code like:
struct Struct {
f: String,
g: String,
}
impl Drop for Struct { ... }
fn main() {
let x = Struct { ... };
drop(x);
x.f = ...;
}
Change this code to not create partially-initialized structures. For
example:
struct Struct {
f: String,
g: String,
}
impl Drop for Struct { ... }
fn main() {
let x = Struct { ... };
drop(x);
x = Struct {
f: ...,
g: ...,
}
}
Closes #18571.
[breaking-change]
----
(Joint authorship by pcwalton and Ryman; thanks all!)
|
2015-02-12 13:55:08 +01:00 |
|