-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Missed niche optimization (Box<impl Sized> & Box<impl Unsized>) #66029
Copy link
Copy link
Closed
Labels
A-codegenArea: Code generationArea: Code generationA-layoutArea: Memory layout of typesArea: Memory layout of typesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationA-layoutArea: Memory layout of typesArea: Memory layout of typesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
playground
Specifically, the tagged union of
ptr::NonNull<{Sized type}>andptr::NonNull<{!Sized type}>can niche together to be the size ofptr::NonNull<{!Sized type}>(for unsized types with non-zero sized metadata) by storing the discriminant for the sized pointer in the 0 niche of the non-null pointer to the unsized type (and the pointer to the sized type in the pointer metadata of the unsized type).