Closed
Description
This code: (Playground link)
fn main() {
let tiles = Default::default();
for row in &mut tiles {
for tile in row {
*tile = 0;
}
}
let tiles: [[usize; 3]; 3] = tiles;
}
Fails with this error:
error[E0282]: type annotations needed
--> src/main.rs:5:13
|
4 | for tile in row {
| ---- consider giving `__next` a type
5 | *tile = 0;
| ^^^^^ cannot infer type for `_`
Type inference (rightfully) fails on this code. However, the variable that it suggests fixing is called __next
and does not actually exist in my code. It is probably some internal variable generated by the compiler.