Repository navigation
Other missing bounds required to meet a trait's blanket impl are displayed too prominently #118779
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
- addedA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Dec 9, 2023 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Dec 9, 2023 Yeah, unsatisfied
Fn-family trait bounds are usually way too prominent in diagnostics. This likely has to do with the fact that special type inference rules apply for them. CC the closed but relevant issue #90970 and this age-old comment of mine #91873 (comment).- addedA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.and removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jan 23, 2024 - added 6 commits that reference this issue
on Mar 1, 2024 - added a commit that references this issue
on Mar 4, 2024 - added 2 commits that reference this issue
on Mar 5, 2024 - added a commit that references this issue
on Mar 5, 2024
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
The first thing the error should make extremely obvious is the Trait that is required.
Then the existing (very useful and clever!) other bounds required to satisfy a blanket impl should be noted.
The fact that a type is implemented by a Blanket impl is often not in the forefront of a user's mind when they encounter this kind of error. They first need to realise that the type they probably think ought to impl a trait, definitely does not in fact impl that trait.
This becomes more important the more traits and types implementing those traits there are in scope, and the more bounds that might not be met.
Other cases
No response
Anything else?
No response