-
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
suggest const_in_array_repeat_expression
flag
#65858
suggest const_in_array_repeat_expression
flag
#65858
Conversation
There's a newly merged, top-down way to compute promotability in We should be able to remove all the infrastructure in |
@ecstatic-morse I've marked this as S-blocked to wait until #65839 is merged, but if you want to merge this as-is and then port it to the new stuff later, feel free to. |
@davidtwco #65839 has been merged. Let me know on Zulip if you have any questions. We may be able to similarly improve error messages when rvalue static promotion fails and Sorry about the timing :/ |
393c606
to
a726578
Compare
@ecstatic-morse I've rebased atop that PR and implemented the suggested approach. |
Thanks @davidtwco! r=me after we discuss the help message. Note that this will be my first review approval as a new member of the rust-lang org. This change is low impact and in code that I am very familiar with, so I think this is fine. |
a726578
to
cfc387d
Compare
This commit adds a suggestion to add the `#![feature(const_in_array_repeat_expression)]` attribute to the crate when a promotable expression is used in a repeat expression. Signed-off-by: David Wood <david@davidtw.co>
cfc387d
to
92b1512
Compare
Looks good to me as well. @bors r+ |
📌 Commit 92b1512 has been approved by |
…error, r=ecstatic-morse suggest `const_in_array_repeat_expression` flag This PR adds a suggestion to add the `#![feature(const_in_array_repeat_expression)]` attribute to the crate when a promotable expression is used in a repeat expression and the feature gate is not enabled. Unfortunately, this ended up being a little bit more complex than I anticipated, which may not have been worth it given that this would all be removed when the feature is stabilized. However, with rust-lang#65732 and rust-lang#65737 being open, and the feature gate having not been being suggested to potential users, the feature might not be stabilized in a while, so maybe this is worth landing. cc @Centril (addresses [this comment](rust-lang#61749 (comment))) r? @ecstatic-morse (opened issues related to RFC 2203 recently)
Rollup of 9 pull requests Successful merges: - #65563 (Add long error explanation for E0587) - #65640 (Use heuristics to recover parsing of missing `;`) - #65643 (Correct handling of type flags with `ConstValue::Placeholder`) - #65825 (rustc: use IndexVec<DefIndex, T> instead of Vec<T>.) - #65858 (suggest `const_in_array_repeat_expression` flag) - #65877 (doc: introduce `once` in `iter::chain` document) - #65887 (doc: mention `get(_mut)` in Vec) - #65891 (self-profiling: Record something more useful for crate metadata generation event.) - #65893 (Output previous stable error messaging when using stable build.) Failed merges: r? @ghost
There is a critical spelling mistake in the suggested attribute. Right now, the compiler suggests this:
...but the real attribute name is This mistake confused me for many hours. Please correct it ASAP. |
@likebike, could you create a new ticket for this linking to your comment here? I'm currently on mobile so I can't create it myself. It is easier to keep track of things that need to be done when there's a ticket for them. |
This PR adds a suggestion to add the
#![feature(const_in_array_repeat_expression)]
attribute to the crate when a promotable expression is used in a repeat expression and the feature gate is not enabled.Unfortunately, this ended up being a little bit more complex than I anticipated, which may not have been worth it given that this would all be removed when the feature is stabilized. However, with #65732 and #65737 being open, and the feature gate having not been being suggested to potential users, the feature might not be stabilized in a while, so maybe this is worth landing.
cc @Centril (addresses this comment)
r? @ecstatic-morse (opened issues related to RFC 2203 recently)