Skip to content

Tracking Issue for Box::into_boxed_sliceΒ #71582

Open

Description

@elichai

This is a tracking issue for Box::into_boxed_slice.
The feature gate for the issue is #![feature(box_into_boxed_slice)].

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

Activity

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

    @programmerjake
    Member

    seems to me that it would be better to instead have the function convert from Box<T> to Box<[T; 1]> since that's the minimal unsafe part, allowing the function to be more general, and since safe code can easily coerce the result to Box<[T]> if needed.

  4. added
    A-slice-vecArea: `[T]` and `Vec<T>`
    Libs-SmallLibs issues that are considered "small" or self-contained
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Jul 29, 2020
  5. m-ou-se commented on Oct 27, 2021

    @m-ou-se
    Member

    Can this be a From impl instead?

  6. elichai commented on Oct 28, 2021

    @elichai
    ContributorAuthor

    @m-ou-se Yes! the only reason this isn't a From impl is because From are insta-stable: #71421 (comment)

  7. elichai commented on Mar 16, 2023

    @elichai
    ContributorAuthor

    This will also be super useful for Rc/Arc
    @m-ou-se Where/How can I discuss turning these into a From impl? (with the insta-stable implications)

  8. zachs18 commented on Jul 21, 2024

    @zachs18
    Contributor

    Making this a From impl would conflict1 with existing From<Box<Local>> for Box<[Local]> impls, since Box is #[fundamental] and thus treated like its pointee for coherence purposes in most cases. (Similarly, std::{array,slice}::from_{ref,mut} becoming From impls would be breaking.)
    I don't think adding From<Rc<T>> for Rc<[T]> or for Rc<[T; 1]> (or Arc) would have the same issue, since Rc/Arc are not #[fundamental].

    Also, we could add alloc::array::from_boxed(_: Box<T>) -> Box<[T; 1]> and alloc::slice::from_boxed(_: Box<T>) -> Box<[T]> analogous to from_ref/from_mut instead of or in addition to having associated fn(s) on Box.

    Footnotes

    1. I suppose a crater run could be done to see if such implementations are common, but I think this would count under the "adding a fundamental trait impl is a major change" section of the API Evolution RFC and might not be allowed regardless. ↩

  9. safinaskar commented on Feb 6, 2025

    @safinaskar
    Contributor

    @rustbot label A-box

  10. added
    A-boxArea: Our favorite opsem complication
    on Feb 6, 2025
  11. added
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    T-libs-api[DEPRECATED; DO NOT USE]
    on Aug 12, 2026
  12. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    and removed
    Libs-SmallLibs issues that are considered "small" or self-contained
    on Oct 7, 2026
  13. removed
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Oct 22, 2026
  14. SleighPenguin22 commented on Nov 20, 2026

    @SleighPenguin22

    Hi all, could I look at adjusting the documentation for this? it would be my first contribution. I posted about it on Zulip also!

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-boxArea: Our favorite opsem complicationA-slice-vecArea: `[T]` and `Vec<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 RFCE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions