-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Map methods on constant sized arrays return dynamically sized arrays. #6562
Comments
I'm not sure this is practical without some sort of dependent types, but in any case, nominating for milestone 1 (well-defined) so we can decide. |
Maybe some kind of For example, pub trait <T> MapUtil: Array<T> {
fn map<S, U: Array<T>>(Self) -> U;
} |
The There's currently no way to implement methods on fixed-size arrays, so the issue here is #7622. |
mgacek8
added a commit
to mgacek8/rust
that referenced
this issue
Mar 4, 2021
Required to resolve rust-lang#6562 rust-clippy issue.
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Mar 25, 2021
…_with_default_with_other_ctors, r=phansch mem_replace_with_default: recognize some std library ctors fixes rust-lang#6562 changelog: mem_replace_with_default: recognize some common constructors equivalent to `Default::default()`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following code samples:
(1)
(2)
Code example number (2) looks much prettier than code example (1) but is incorrect, as it returns a dynamically sized array. The code returns a dynamically sized array because the objects array is coerced to a dynamically sized array, and then the map method is called on the dynamic array. Can some method of making code sample number (2) happen be implemented? Right now, the behaviour is unintuitive, and annoying.
The text was updated successfully, but these errors were encountered: