-
Notifications
You must be signed in to change notification settings - Fork 118
GEN-203: Report could use ThinVec<Frame> instead of Box<Vec<Frame>> #5408
Copy link
Copy link
Open
Labels
area/dxImprovements or additions to DX or docsImprovements or additions to DX or docsarea/libsRelates to first-party libraries/crates/packages (area)Relates to first-party libraries/crates/packages (area)area/libs > error-stackAffects the `error-stack` crate (library)Affects the `error-stack` crate (library)category/enhancementNew feature or requestNew feature or requestlang/rustPull requests that update Rust codePull requests that update Rust codepriority/3 lowLower priority: nice-to-haveLower priority: nice-to-have
Metadata
Metadata
Assignees
Labels
area/dxImprovements or additions to DX or docsImprovements or additions to DX or docsarea/libsRelates to first-party libraries/crates/packages (area)Relates to first-party libraries/crates/packages (area)area/libs > error-stackAffects the `error-stack` crate (library)Affects the `error-stack` crate (library)category/enhancementNew feature or requestNew feature or requestlang/rustPull requests that update Rust codePull requests that update Rust codepriority/3 lowLower priority: nice-to-haveLower priority: nice-to-have
Related Problem
Box<Vec<Frame>>is double indirection, but is being used here to minimize the inline size so thebox_collectionclippy lint is being silenced.Source:
hash/libs/error-stack/src/report.rs
Line 251 in 958822e
Proposed Solution
The ThinVec crate can be used to remove the double indirection while keeping the single inline pointer size by storing the capacity and length at the start of the allocation.
This crate is trusted by
rustc, so shouldn't have any issues with trusting a new dependency.Alternatives
Keep as-is which will continue the double indirection, although on the cold path.
Additional context
No response