Closed
Description
This code producesses an unclear error
pub trait ValueGiver<T> {
fn give(_: Option<Self>) -> T;
}
struct m;
impl<f64> ValueGiver<f64> for m {
fn give(_:Option<m>) -> f64 {
0.5f64
}
}
fn main() {
let y : f64 = ValueGiver::give(None::<m>);
}
Here the error of course is the impl<f64>
that should be impl
, but the error message is not clear :
c.rs:64:5: 68:6 error: unable to infer enough type information about `_`; type annotations required
c.rs:64 impl<f64> ValueGiver<f64> for m {
c.rs:65 fn give(_:Option<m>) -> f64 {
c.rs:66 0.5f64
c.rs:67 }
c.rs:68 }
Could this error message be more helpful ?