-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-error-codesArea: Explanation of an error code (--explain)Area: Explanation of an error code (--explain)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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 enum
s, 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.33Alias::<T>::None
has 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
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-error-codesArea: Explanation of an error code (--explain)Area: Explanation of an error code (--explain)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.