-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Suggest array::from_fn in array initialization #119530
Comments
Personally, I prefer @Nilstrieb @lcnr what do you think? |
Once |
Agreed, good point about Even if we stabilize inline const, it might make sense to wait with suggesting it for a while so that we don't make code depend on the latest MSRV immediately. So therefore, I think that it might still make sense to implement this in the meantime. |
I think this should (in the future) suggest |
…vidtwco Suggest array::from_fn for array initialization Fixes rust-lang#119530
Rollup merge of rust-lang#119805 - chenyukang:yukang-fix-119530, r=davidtwco Suggest array::from_fn for array initialization Fixes rust-lang#119530
For this snippet (playground):
rustc gives:
Since #113912, for const-able values, rustc suggests the creation of a constant binding. Here this is not possible because
foo
is not const fn. However, we can suggestarray::from_fn
instead.The text was updated successfully, but these errors were encountered: