don't suggest non-deriveable traits for unions#154118
Open
malezjaa wants to merge 1 commit intorust-lang:mainfrom
Open
don't suggest non-deriveable traits for unions#154118malezjaa wants to merge 1 commit intorust-lang:mainfrom
malezjaa wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing |
Collaborator
|
rustbot has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
Can you please add a test to reflect new behaviour |
8fd2da8 to
ccaae21
Compare
JonathanBrouwer
requested changes
Mar 20, 2026
compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs
Outdated
Show resolved
Hide resolved
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
Contributor
|
cc @mejrs |
Don't suggest non-deriveable tests for unions. This also adds enum, struct and union markers to rustc_on_unimplemented
ccaae21 to
dd844f3
Compare
mejrs
approved these changes
Mar 20, 2026
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
Show resolved
Hide resolved
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
Author
|
I forgot to rebless the test. Will do that in a sec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc #137587
Before, the compiler suggested adding
#[derive(Debug)](other traits too) for unions,which is misleading because some traits can't be automatically derived.
Only traits that are still suggested are Copy and Clone.
I noticed the error label changed after removing the suggestion. I hope this isn't a big deal, but let me know if that's an issue.
original example:
before:
after (the message doesn't suggest adding #[derive(Debug)] to unions)