Closed
Description
The latest Nightly (rustc 1.22.0-nightly f1b5225 2017-10-01, Gnu64) doesn't perform type inference in many cases, an example:
fn foo(mut n: u32, k: u32) -> u64 {
let mut res: u64 = 1;
for i in 0 .. k {
res *= n.into();
n -= 1;
res /= i.into();
}
res % 1000
}
fn main() {}
Gives:
error[E0283]: type annotations required: cannot resolve `u64: std::ops::MulAssign<_>`
--> ...\test.rs:4:13
|
4 | res *= n.into();
| ^^
I have seen several other cases of missed type inference in this Nightly, with sum() and product() in code that compiles every day since months.
The Beta and the Nightly of one or two days before doesn't show this problem.