Skip to content

E0109 is out of date #116876

Open
Open
@QuineDot

Description

@QuineDot

Code

fn main() {
    let _ = Option::<_>::None::<()>;
    type Alias<T> = Option<T>;
    let _ = Alias::None::<()>;
}
// Followed by running `rustc --explain E0109`

Current output

[Bottom of `rustc --explain E0109`]

Note that generic arguments for `enum` variant constructors go after the variant, not after the `enum`. For example, you would write `Option::None::<u32>`, rather than `Option::<u32>::None`.

Desired output

Note that generic arguments for `enum` variant constructors can go after the variant *or* after the `enum`, but not both.  For example, you can write `Option::None::<u32>` or `Option::<u32>::None`, but not `Option::<u32>::None::<u32>`.

Additionally, generic arguments for `type` aliases of `enum`s go after the `enum`, not after the variant.  For example, if `Alias<T>` is a `type` alias of `Option<T>`, you would write `Alias::<u32>::None`, rather than `Alias::None::<u32>`.

Rationale and extra context

Generic arguments can go after the enum now. Moreover, for type aliases of enums, generic arguments must go after the enum and not after the variant.

See this stabilization report for details. In brief,

  • Option::<T>::None has worked since Rust 1.33
  • Alias::<T>::None has worked since Rust 1.37, but
  • Alias::None::<T> doesn't work so far (Rust 1.73)

Other cases

No response

Anything else?

@rustbot labels +A-error-codes

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-error-codesArea: Explanation of an error code (--explain)C-bugCategory: This is a bug.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