You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
…veklabnik
I tried to add an inline `span_suggestion()` to the error as well, but since generics don't have their own span it becomes too fragile/complicated to work.
r? @steveklabnikfixesrust-lang#19477
…veklabnik
I tried to add an inline `span_suggestion()` to the error as well, but since generics don't have their own span it becomes too fragile/complicated to work.
r? @steveklabnikfixesrust-lang#19477
This code producesses an unclear error
Here the error of course is the
impl<f64>
that should beimpl
, but the error message is not clear :Could this error message be more helpful ?
The text was updated successfully, but these errors were encountered: