Closed
Description
Code that asks for some type inference:
fn main() {
let n: u32 = 1;
let mut d: u64 = 2;
d = d % n.into();
}
It gives:
error[E0284]: type annotations needed for `u64`
--> ...\test.rs:4:11
|
3 | let mut d: u64 = 2;
| ----- consider giving `d` a type
4 | d = d % n.into();
| ^ cannot infer type for type `u64`
|
= note: cannot satisfy `<u64 as std::ops::Rem<_>>::Output == u64`
The error message "consider giving d
a type" refers to a "d" that is actually typed as u64.
Using rustc 1.44.0-nightly (3360cc3 2020-04-24).