Closed
Description
The feature gate for the issue is #![feature(vec_spare_capacity)]
.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Adjust documentation (see instructions on rustc-dev-guide)Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
Implementation history
- Initial implementation (Add Vec::spare_capacity_mut #75015)
Metadata
Metadata
Assignees
Labels
Area: `std::collections`Area: raw pointers, MaybeUninit, NonNullBlocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are tracked on the team's project board.Relevant to the library API 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.
Activity
danielhenrymantilla commentedon Sep 17, 2020
FWIW, here is a full-featured API provided by an external crate: https://docs.rs/uninit/0.3.0/uninit/extension_traits/trait.VecCapacity.html#foreign-impls
djc commentedon Jan 20, 2021
I wonder how this API relates to
ReadBuf
. It would be great if there was some safe API that wrapped around the use ofReadBuf
to access aVec
's spare capacity, then updatedlen
based on theReadBuf
sfilled
.the8472 commentedon Jan 31, 2021
Maybe we should follow that example and generalize
spare_capacity_mut()
to return(&mut [T], &mut [MaybeUninit<T>])
?Shnatsel commentedon Feb 2, 2021
#79015 has implemented that, albeit as a private function. Sounds like a good idea to me.
the8472 commentedon Feb 9, 2021
Since #81944 exists now I think
vec_spare_capacity
is redundant.Rollup merge of rust-lang#81687 - WaffleLapkin:split_at_spare, r=KodrAus
WaffleLapkin commentedon Apr 13, 2021
@the8472
That's not actually true due to pointer invalidation, see #81944 (comment) and #82564
24 remaining items