Skip to content

Tracking Issue for partial_init_locals #153699

@dingxiangfei2009

Description

@dingxiangfei2009

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

Metadata

Metadata

Labels

A-in-place-initArea: in-place initializationA-rust-for-linuxRelevant for the Rust-for-Linux projectC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-partial_init_locals`#[feature(partial_init_locals)]`T-langRelevant to the language team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions