Closed
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.