-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support each_ref
and each_mut
in [T; N]
in constant expressions.
#133288
base: master
Are you sure you want to change the base?
Conversation
r? libs-api @rustbot label +T-libs-api -T-libs |
390add8
to
7c799c3
Compare
Should lifetimes be explicit here or can the compiler still deduce that they derive from that of |
E.g.: pub const fn each_ref<'a>(&'a self) -> [&'a T; N]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should lifetimes be explicit here or can the compiler still deduce that they derive from that of
self
?
Not an issue; the compiler is able to infer them as intended.
@bors r+ |
Tracking issue: #133289
The methods
<[T; N]>::each_ref
and<[T; N]>::each_mut
can easily be reimplemented to allow marking them with theconst
specifier.This specific implementation takes a different approach than the original as to avoid using iterators (which are illegal in constant expressions).