Skip to content

Tracking Issue for const_array_each_ref #133289

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
1 of 3 tasks
bjoernager opened this issue Nov 21, 2024 · 0 comments
Open
1 of 3 tasks

Tracking Issue for const_array_each_ref #133289

bjoernager opened this issue Nov 21, 2024 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@bjoernager
Copy link
Contributor

bjoernager commented Nov 21, 2024

Feature gate: #![feature(const_array_each_ref)]

This is a tracking issue for supporting the each_ref and each_mut methods in [T; N] in constant expressions.

Public API

impl<T, const N: usize> [T; N] {
    pub const fn each_ref(&self) -> [&T; N];

    pub const fn each_mut(&mut self) -> [&mut T; N];
}

Unresolved Questions

  • None yet.
@bjoernager bjoernager added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Nov 21, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this issue Nov 22, 2024
…=jhpratt

Support `each_ref` and `each_mut` in `[T; N]` in constant expressions.

Tracking issue: rust-lang#133289

The methods `<[T; N]>::each_ref` and `<[T; N]>::each_mut` can easily be reimplemented to allow marking them with the `const` specifier.

This specific implementation takes a different approach than the original as to avoid using iterators (which are illegal in constant expressions).
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 22, 2024
Rollup merge of rust-lang#133288 - bjoernager:const-array-each-ref, r=jhpratt

Support `each_ref` and `each_mut` in `[T; N]` in constant expressions.

Tracking issue: rust-lang#133289

The methods `<[T; N]>::each_ref` and `<[T; N]>::each_mut` can easily be reimplemented to allow marking them with the `const` specifier.

This specific implementation takes a different approach than the original as to avoid using iterators (which are illegal in constant expressions).
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant