Skip to content

supplying generic args to variant and enum results in weird error #93993

Closed
@lcnr

Description

@lcnr
fn main() {
    let x = Option::<u32>::Some::<u32>(3);
}

results in

[E0109]: type arguments are not allowed for this type
 --> src/main.rs:2:35
  |
2 |     let x = Option::<u32>::Some::<u32>(3);
  |                                   ^^^ type argument not allowed

this error is far from ideal. we ideally mention that variants may only have generic arguments if their enum doesn't have any. not sure what's the best wording here or how to best achieve this

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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