Skip to content

Tracking Issue for const_array #147606

Open
Open

Description

@bend-n

Feature gate: #![feature(const_array)]

This is a tracking issue for const [T]::map and array::from_fn.

Public API

// core::array
impl<T, const N: usize> [T; N] {
    pub const fn map<F, U>(self, f: F) -> [U; N]
    where
        F: [const] FnMut(T) -> U + [const] Destruct,
        U: [const] Destruct;
}

pub const fn from_fn<T: [const] Destruct, const N: usize, F>(f: F) -> [T; N]
where
    F: [const] FnMut(usize) -> T + [const] Destruct;

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions

  • Should array::try_map be constified

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩

Activity

  1. added
    T-libs-api[DEPRECATED; DO NOT USE]
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Oct 12, 2025
  2. bend-n commented on Feb 7, 2026

    @bend-n
    ContributorAuthor

    @rustbot label -S-tracking-unimplemented

  3. 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
  4. syberant commented on Aug 27, 2026

    @syberant

    Hi! Just ran into a usecase for this: generating a const lookup table from another array.
    My workaround for stable Rust was some ugly code involving a new array whose elements I completely replace in a while loop.

    Given that array::try_from_fn (#89379) and array::try_map (#79711) are both still unstable in non-const contexts I would personally like to only try to stabilise const array::from_fn and array::map.

    Kind of new to this, is there anything preventing this from proceeding to FCP?

  5. bend-n commented on Aug 27, 2026

    @bend-n
    ContributorAuthor

    This feature is kind of very far from stabilization, as it depends, primarily, on #143874, which is not very close to stabilization, and not only that but to be useful it requires #106003. To use this on stable you'd have to use some macro based solution.

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

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-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