rust-lang / rust-lang/rust

Tracking Issue for `partial_init_locals`

Open
#153,699 6 comments 3 reactions 1 assignee View on GitHub

@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
Unresolved Questions
Implementation history
  • Initial implementation in #152774

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.