Closed
Description
Tracking issue for rust-lang/rfcs#1444.
Unresolved questions:
- Does assigning directly to a union field trigger a drop of the previous contents?
- When moving out of one field of a union, are the others considered invalidated? (1, 2, 3, 4)
- Answered by Union initialization and Drop rfcs#2514.
- Under what conditions can you implement
Copy
for a union? For example, what if some variants are of non-Copy type? All variants? - What interaction is there between unions and enum layout optimizations? (Unions interacting with Enum layout optimization #36394)
Open issues of high import:
- Matching on uninhabited unsafe places (union fields, raw pointer dereferences, etc.) allowed in safe code. #47412 -- MIR-based unsafety checker sometimes accepts unsafe accesses to union fields in presence of uninhabited fields
Metadata
Metadata
Assignees
Labels
Blocker: Approved by a merged RFC but not yet implemented.Blocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFC`#![feature(untagged_unions)]`Relevant to the language team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.