Skip to content

Tracking Issue for Vec::spare_capacity_mut #75017

Closed
@Amanieu

Description

@Amanieu
Member

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

Unresolved Questions

Implementation history

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Aug 1, 2020
added
B-unstableBlocker: Implemented in the nightly compiler and unstable.
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
on Aug 1, 2020
added
Libs-TrackedLibs issues that are tracked on the team's project board.
A-raw-pointersArea: raw pointers, MaybeUninit, NonNull
on Aug 6, 2020
danielhenrymantilla

danielhenrymantilla commented on Sep 17, 2020

@danielhenrymantilla
Contributor

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

djc commented on Jan 20, 2021

@djc
Contributor

I wonder how this API relates to ReadBuf. It would be great if there was some safe API that wrapped around the use of ReadBuf to access a Vec's spare capacity, then updated len based on the ReadBufs filled.

the8472

the8472 commented on Jan 31, 2021

@the8472
Member

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

Maybe we should follow that example and generalize spare_capacity_mut() to return (&mut [T], &mut [MaybeUninit<T>])?

Shnatsel

Shnatsel commented on Feb 2, 2021

@Shnatsel
Member

Maybe we should follow that example and generalize spare_capacity_mut() to return (&mut [T], &mut [MaybeUninit<T>])?

#79015 has implemented that, albeit as a private function. Sounds like a good idea to me.

the8472

the8472 commented on Feb 9, 2021

@the8472
Member

Since #81944 exists now I think vec_spare_capacity is redundant.

added a commit that references this issue on Feb 10, 2021

Rollup merge of rust-lang#81687 - WaffleLapkin:split_at_spare, r=KodrAus

e2765f8
WaffleLapkin

WaffleLapkin commented on Apr 13, 2021

@WaffleLapkin
Member

@the8472

Since #81944 exists now I think vec_spare_capacity is redundant.

That's not actually true due to pointer invalidation, see #81944 (comment) and #82564

24 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`A-raw-pointersArea: raw pointers, MaybeUninit, NonNullB-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @djc@Amanieu@Shnatsel@the8472@jonas-schievink

      Issue actions

        Tracking Issue for Vec::spare_capacity_mut · Issue #75017 · rust-lang/rust