-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest derivable trait on E0277 error #95525
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon. Please see the contribution instructions for more information. |
I think this diagnostic needs to be a bit more specific. Ideally it should only suggest deriving |
This comment has been minimized.
This comment has been minimized.
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
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.
I left an idea for a way to limit the suggestions only to places that are relatively(*) accurate, so we don't suggest to derive Copy
on, e.g.
struct Foo {
s: String,
}
(*) = It's not exactly how the derive macro works, but it should limit really inaccurate suggestions at least.
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Show resolved
Hide resolved
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
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.
A few more changes to fix predicate_must_hold_modulo_regions
check for PartialEq
and PartialOrd
, then I think it's ready!
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
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
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.
sorry for the back and forth-- almost there, but one more change. also @ohno418 , can you finally squash all of the commits that start with "fix"? is fine to have multiple commits, but 8 seems like too much.
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
e9beb6d
to
de23782
Compare
Wonderful. Thanks! @bors r+ |
📌 Commit de23782 has been approved by |
…77, r=compiler-errors Suggest derivable trait on E0277 error Closes rust-lang#95099 .
@ohno418, can you re-bless the test suite? then we can try to land this again. |
@compiler-errors |
@bors r+ rollup=never |
📌 Commit b831b60 has been approved by |
@bors rollup=maybe |
⌛ Testing commit b831b60 with merge 8068b794100ac89988924fd0d3582d5fa17eda5a... |
…77, r=compiler-errors Suggest derivable trait on E0277 error Closes rust-lang#95099 .
@bors retry (yield to rollup containing this) |
Rollup of 4 pull requests Successful merges: - rust-lang#95525 (Suggest derivable trait on E0277 error) - rust-lang#95654 (diagnostics: use correct span for const generics) - rust-lang#95660 (Update panic docs to make it clearer when to use panic vs Result) - rust-lang#95670 (Refactor: remove unused function parameters) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Closes #95099 .