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
Code
Current output
Desired output
Rationale and extra context
Generic arguments can go after the
enumnow. Moreover, for type aliases ofenums, generic arguments must go after theenumand not after the variant.See this stabilization report for details. In brief,
Option::<T>::Nonehas worked since Rust 1.33Alias::<T>::Nonehas worked since Rust 1.37, butAlias::None::<T>doesn't work so far (Rust 1.73)Other cases
No response
Anything else?
@rustbot labels +A-error-codes