This doesn't type-check
fn main() {
let m = [[0.; 2]; 2];
println!("{}", (|i, j| m[i][j])(0, 1));
}
failing with
error[E0282]: type annotations needed
--> inf.rs:3:28
|
3 | println!("{}", (|i, j| m[i][j])(0, 1));
| ^^^^ cannot infer type
Annotating as usize fixes it, but I would expect the compiler to be able to infer the type. Is there a reason why it can't?
This doesn't type-check
failing with
Annotating as
usizefixes it, but I would expect the compiler to be able to infer the type. Is there a reason why it can't?