Tracking Issue for `partial_init_locals`
Open
@dingxiangfei2009 is already working on this.
Since Mar 11, 2026.
A-in-place-init
A-rust-for-linux
C-tracking-issue
F-partial_init_locals
T-lang
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for the RFC "XXX" (rust-lang/rfcs#NNN).
The feature gate for the issue is #![feature(partial_init_locals)].
This is a small subgoal for the experiment rust-lang/lang-team#336.
This feature is to partially undo #54986 on a sane set-up. Types with no Drop can be sanely initialised gradually one field at a time.
struct A {
a: u8,
b: (u64, u64),
}
let data: A;
data.b.0 = 0;
//~ `data` not initialised
data.b.1 = 1;
//~ `data` still not initialised, but `data.b` is
data.a = 0;
// `data` is fully initialised.
data.a = 1;
//~ ERROR `data` is not mutable.
Steps
- Implement the feature, see #152774
- Adjust documentation (see instructions on rustc-dev-guide)
- Style updates for any new syntax (nightly-style-procedure)
- Style team decision on new formatting
- Formatting for new syntax has been added to the Style Guide
- (non-blocking) Formatting has been implemented in
rustfmt
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
Implementation history
- Initial implementation in #152774
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.