Skip to content

::: typo in turbofish doesn't have a good error #65569

Closed

Description

The following code is using a single : instead of a mod-sep :::

fn main() -> Result<(), ()> {
    vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
    Ok(())
}

The compiler doesn't point at the problem:

error: expected `::`, found `(`
 --> src/main.rs:2:55
  |
2 |     vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
  |                                                       ^ expected `::`

It should point at the : after collect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The parsing of Rust source code to an ASTD-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions