Skip to content

Handle missing turbofish with multiple type params in the parser #76072

Closed
@estebank

Description

@estebank

We currently emit an appropriate error when encountering a path with type parameters that isn't using the turbofish:

error: comparison operators cannot be chained
 --> src/main.rs:2:40
  |
2 |     let hm  = std::collections::HashMap<i128>::new();
  |                                        ^    ^
  |
help: use `::<...>` instead of `<...>` to specify type arguments
  |
2 |     let hm  = std::collections::HashMap::<i128>::new();
  |                                        ^^

but we apparently fail to handle this when multiple type parameters are provided:

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
 --> src/main.rs:2:45
  |
2 |     let hm  = std::collections::HashMap<i128, i128>::new();
  |                                             ^ expected one of 7 possible tokens

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.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