Open
Description
Spawned off of #21232
In the long-term, we want to accept code like this:
struct S { x: u32, y: u32 }
fn main() { let mut s: S; s.x = 10; s.y = 30; a_use_of(&s); another_use_of(s); }
fn a_use_of(_s: &S) { /* ... */ }
fn another_use_of(_s: S) { /* ... */ }
We probably also want to start accepting this too:
struct S { x: u32, y: u32 }
fn main() { let mut s: S; s.x = 10; a_use_of_field(s.x); }
fn a_use_of_field(_x: u32) { /* ... */ }
(But that second example is more debatable. I don't think there's any debate about the first example.)
See #54986 for the short-term goal of rejecting all partial initializations until we can actually use the results you get from partial initialization.