Skip to content

Tracking Issue for array_methods #76118

Closed

Description

@LukasKalbertodt

This is a tracking issue for a couple of basic methods on arrays. The feature gate for the issue is #![feature(array_methods)]. Currently, this includes the following methods:

Note: these methods were all collected under the same array_methods feature name as I suspect many (often small) methods to be added to array in the near future. Creating a new feature and tracking issue for each seems overkill. We can still split off some methods into dedicated features later, if required.

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

Activity

  1. added
    T-libs-api[DEPRECATED; DO NOT USE]
    B-unstableBlocker: Implemented in the nightly compiler and unstable.
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Aug 30, 2020
  2. LukasKalbertodt commented on Aug 30, 2020

    @LukasKalbertodt
    ContributorAuthor

    Just for the protocol, I plan to add the following methods in the near future:

    (discussions about the usefulness of those method should be had in the dedicated PR threads and not here)

  3. added a commit that references this issue on Sep 3, 2020
  4. added
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Sep 10, 2020
  5. usbalbin commented on Nov 29, 2020

    @usbalbin
    Contributor

    @LukasKalbertodt I have opened PR #79451 for zip, saw your comment just now.

  6. rossmacarthur commented on May 11, 2021

    @rossmacarthur
    Contributor

    With regards to stabilization I think as_slice, as_mut_slice could be stabilized first.

    I think they are much more useful than the others in this tracking issue. These are already common methods for existing data types so it's not a new API.

    I sometimes find myself running into cases where Deref coercion doesn't work and I need this. Currently I'm using &arr[..] which doesn't really communicate well why it is needed.

    For example

    // io::Read does something like this
    trait Trait {}
    impl Trait for &[u8] {}
    impl<T: Trait + ?Sized> Trait for &mut T {}
    
    fn takes_trait(t: impl Trait) {}
    
    fn main() {
        let mut arr = [0, 1, 2, 3];
        
        // currently
        takes_trait(&mut &arr[..]);
        
        // with `.as_slice()` its nice and clear
        takes_trait(&mut arr.as_slice());
        
        // can't use deref coercion in this case
        takes_trait(&mut &arr);
        //          ^^^^^^^^^ the trait `Trait` is not implemented for `&[u8; 4]`
    }
  7. LukasKalbertodt commented on Jun 23, 2021

    @LukasKalbertodt
    ContributorAuthor

    I agree with @rossmacarthur and would like to propose stabilizing as_slice and as_mut_slice. These methods exist on many other types throughout std (e.g. Vec) and I can't think of a reason to wait with stabilization. I can't see how the name or semantics would still change. And I'm pretty sure we want those methods.

  8. jhpratt commented on Aug 26, 2021

    @jhpratt
    Member

    Partial stabilization is up: #88353

  9. 21 remaining items

  10. added
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    on Sep 17, 2023
  11. pravic commented on Oct 20, 2023

    @pravic
    Contributor

    Any news about this?

  12. added
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    and removed
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    on Jan 16, 2024
  13. rfcbot commented on Jan 16, 2024

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  14. added and removed
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Jan 26, 2024
  15. rfcbot commented on Jan 26, 2024

    @rfcbot

    The final comment period, with a disposition to merge, as per the review above, is now complete.

    As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

    This will be merged soon.

  16. added 2 commits that reference this issue on Jan 26, 2024
    94723d4
    c9ab37b
  17. added a commit that references this issue on Jan 27, 2024
    ea29124
  18. added a commit that references this issue on Jan 28, 2024
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-arrayArea: `[T; N]`A-sliceArea: `[T]`B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-radarLibs issues that are tracked on the team's radar.T-libs-api[DEPRECATED; DO NOT USE]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

      No branches or pull requests

      Issue actions