-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Extremely confusing error around function pointers with inferred arguments #76353
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceA-type-systemArea: Type systemArea: Type 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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types 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 lintsA-inferenceArea: Type inferenceArea: Type inferenceA-type-systemArea: Type systemArea: Type 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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Consider the following code (playground):
Rustc gives an error:
Here is the fixed code (playground):
In particular, the only thing that changed was
fn(_, _)->fn(&str, &S<'_>). But this is exactly the type that was printed in the diagnostic originally! What changed?I don't understand why this error was emitted, but it would at least be nice to suggest the transformation that makes the code work.
Reduced from rust-lang/crater#542.