Skip to content

Type specifiers with generic args in certain positions should generate errors that reference the turbofish #114112

Closed
@aathan

Description

@aathan

Code

I'm having trouble creating a concise example, but perhaps the error below is enough. If the error at least mentioned turbofish it'd have saved a bunch of heartache for a noob.

Current output

error: expected one of `)`, `,`, `@`, or `|`, found `<`
   --> ....
    |
143 |             Ok(SomeEnum<STRICT>::SomeVariant { result, .. }) => { ... },
    |                           ^
    |                           |
    |                           expected one of `)`, `,`, `@`, or `|`
    |                           help: missing `,`

Desired output

" if SomeEnum<STRICT> is a type reference, use SomeEnum::<STRICT> instead"

Rationale and extra context

Rust is elsewhere good about suggesting the turbofish.

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTA-patternsRelating to patterns and pattern matchingD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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