Closed
Description
This works on stable and beta, fails to compile on nightly.
trait Make {
fn make() -> Self;
}
impl Make for f64 {
fn make() -> f64 {
1.0
}
}
fn make_value<T: Make>() -> T {
T::make()
}
fn main() {
let mut sum = 0.0;
let val = make_value();
sum += val;
println!("{:}", sum);
}
error[E0282]: type annotations needed
--> src/main.rs:18:9
|
18 | let val = make_value();
| ^^^
| |
| cannot infer type for `_`
| consider giving `val` a type
Versions tried:
rustc 1.20.0 (f3d6973f4 2017-08-27) - works
rustc 1.21.0-beta.3 (ea1fd7d42 2017-09-15) - works
rustc 1.22.0-nightly (185cc5f26 2017-10-02) - fails