Skip to content

E0593 regression when mismatched argument count leads to other errors in Beta/Nightly #47244

Closed
@Rantanen

Description

@Rantanen

Playground

use std::collections::HashMap;
fn main() {
    
    let m = HashMap::new();
    m.insert( "foo", "bar" );
    
    m.iter().map( |_, b| { // Stable ONLY:
                           // > [E0593]: closure is expected to take a single tuple as argument

        b.to_string()      // Stable + Beta + Nightly:
                           // > [E0619]: the type of this value must be known in this context
    });
}

Commenting out the b.to_string() will yield the [E0593] error in all toolchains.

The [E0619] alone makes for a very confusing error message, as the user's assumption is that the type of b is correct.

Metadata

Metadata

Assignees

Labels

A-closuresArea: Closures (`|…| { … }`)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions