Closed
Description
The following example
fn main() {
let a = vec![(1, 2)];
let b: Vec<_> = a.iter().map(|x: (u32, u32)| 45).collect();
}
gives the following error on nightly:
error[E0593]: closure takes 2 arguments but 1 argument is required
--> src/main.rs:4:30
|
4 | let b: Vec<_> = a.iter().map(|x: (u32, u32)| 45).collect();
| ^^^ ------------------ takes 2 arguments
| |
| expected closure that takes 1 argument
which is wrong (map
is expecting a function with one argument, which is what this closure is) and the following correct message on stable/beta:
error[E0281]: type mismatch: the type `[closure@src/main.rs:4:34: 4:52]` implements the trait `std::ops::FnMut<((u32, u32),)>`, but the trait `std::ops::FnMut<(&({integer}, {integer}),)>` is required (expected reference, found tuple)
--> src/main.rs:4:30
|
4 | let b: Vec<_> = a.iter().map(|x: (u32, u32)| 45).collect();
| ^^^