-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
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();
| ^^^
rbalicki2, Eijebong, estebank, Hi-Angel and srinivasreddy
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics