-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
impl dyn Trait on an auto trait produces a confusing diagnostic #85026
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given the following code (playground):
The current output is:
This is rather confusing. It's not immediately clear what the difference between
impl dyn Unpinand this working code is (playground):Since
impl dyn Ais accepted, the user might be confused whydyn Awould be considered a nominal type whendyn Unpinisn't. The real reason whyimpl dyn Unpinis an error is because it is animplblock fora type[edit: a dynamically dispatched auto trait] from another crate, which should be handled byE0116.Ideally the output should look like: