-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 to create a new const
item if the fn
in the array is a const fn
#81503
Suggest to create a new const
item if the fn
in the array is a const fn
#81503
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
I'm looking into the errors. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
r? @Aaron1011 |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Show resolved
Hide resolved
@rustbot label -S-waiting-on-author +S-waiting-on-review |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
I helped with writing this PR, so let's get someone else to do a final review. r? @estebank |
This comment has been minimized.
This comment has been minimized.
Does this PR conflict with #80404, which removes |
They touch the same files, but this PR removes the specialized diagnostic for that feature, so everything should be fine after a rebase. |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
9db7bc8
to
6cd36bd
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6c0add5
to
275e426
Compare
This comment has been minimized.
This comment has been minimized.
275e426
to
885556d
Compare
This comment has been minimized.
This comment has been minimized.
…repeat expression is a `const fn`
885556d
to
c2e849c
Compare
@estebank Do I need to make any further changes? |
Friendly ping @estebank :) |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Show resolved
Hide resolved
@estebank Done ✅ |
@bors r+ |
📌 Commit 64fe2c1 has been approved by |
…as-schievink Rollup of 19 pull requests Successful merges: - rust-lang#81503 (Suggest to create a new `const` item if the `fn` in the array is a `const fn`) - rust-lang#81897 (Add match pattern diagnostics regression test) - rust-lang#81975 (Seal the CommandExt, OsStrExt and OsStringExt traits) - rust-lang#82009 (const_generics: Dont evaluate array length const when handling errors) - rust-lang#82060 (Fix typos in BTreeSet::{first, last} docs) - rust-lang#82061 (CTFE validation: catch ReadPointerAsBytes and better error) - rust-lang#82063 (Fixed minor typo in catch_unwind docs) - rust-lang#82067 (const_generics: Fix incorrect ty::ParamEnv::empty() usage) - rust-lang#82077 (Edit `rustc_arena::DropArena` docs) - rust-lang#82096 (Fix a typo) - rust-lang#82106 (Remove unnecessary `Option` in `default_doc`) - rust-lang#82107 (expand: Some cleanup) - rust-lang#82118 (Add missing env!-decl variant) - rust-lang#82119 (Fix typo in link to CreateSymbolicLinkW documentation.) - rust-lang#82120 (Stabilize Arguments::as_str) - rust-lang#82129 (Remove redundant bool_to_option feature gate) - rust-lang#82133 (Update link for extern prelude.) - rust-lang#82141 (32-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output register.) - rust-lang#82147 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…r=estebank Diagnostic cleanups Follow up to rust-lang#81503 Helps with rust-lang#82916 (don't show note if `span` is `DUMMY_SP`)
Fixes #73734. If the
fn
in the array repeat expression is aconst fn
, suggest creating a newconst
item. On nightly, suggest creating an inlineconst
block. This PR also removes thesuggest_const_in_array_repeat_expressions
as it is no longer necessary.Example:
Gives this error:
With this change, this is the error message: