Skip to content

Detect invalid turbofish foo.bar::Type<T>()in the parser #74065

@estebank

Description

@estebank

Detect when the user has likely forgotten to wrap the type param with the type param delimiters:

fn main() {
    let _ = vec![1, 2, 3].into_iter().collect::Vec<_>();
}

where we currently emit:

error: expected one of `(`, `.`, `;`, `?`, or an operator, found `::`
 --> src/main.rs:2:46
  |
2 |     let _ = vec![1, 2, 3].into_iter().collect::Vec<_>();
  |                                              ^^ expected one of `(`, `.`, `;`, `?`, or an operator

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 ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.P-lowLow priorityT-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