-
-
Notifications
You must be signed in to change notification settings - Fork 15k
RawVec stores a capacity field even if T is zero-sized #45431
Copy link
Copy link
Open
Labels
A-ZSTArea: Zero-sized types (ZSTs).Area: Zero-sized types (ZSTs).A-layoutArea: Memory layout of typesArea: Memory layout of typesA-specializationArea: Trait impl specializationArea: Trait impl specializationC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-ZSTArea: Zero-sized types (ZSTs).Area: Zero-sized types (ZSTs).A-layoutArea: Memory layout of typesArea: Memory layout of typesA-specializationArea: Trait impl specializationArea: Trait impl specializationC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchI-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When
std::mem::size_of::<T>() == 0RawVec<T>has always a capacity equal tostd::usize::MAXelements. It currently stores acap: usizethat always contains this value but doing so is unnecessary in this case.@withoutboats this would be a not so far fetched case for allowing
structspecialization like @arielb1 proposed.