-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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
I tried this code:
// the error is reported here
let em = |v: f64| -> f64 { v };
let x: f64 = em(1i16.into());
// but originates here
let y: f64 = 0.01f64 * 1i16.into();
The error message:
error[E0284]: type annotations needed for `f64`
--> src/main.rs:3:15
|
3 | let em = |v: f64| -> f64 { v };
| ^ consider giving this closure parameter a type
|
= note: cannot resolve `<f64 as std::ops::Mul<_>>::Output == f64`
I expected to see this happen: The error is reported on the line for y
.
Instead, this happened: The error is reported for the closure…
Meta
Nighty, Beta and Stable affected.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.