-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`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
We currently support Enum::Variant { field: N } and Struct { field: N } as const arguments under min_generic_const_args. We should also support Enum::Variant(N) and Struct(N) syntax.
#![feature(min_generic_const_args, adt_const_params)]
#[derive(Eq, PartialEq, core::marker::ConstParamTy)]
enum Option<T> {
Some(T),
None,
}
fn takes_option<const O: Option<u32>() {}
fn generic_caller<const N: u32>() {
takes_option::<{ Option::<u32>::Some(N) }>();
takes_option::<{ <Option<u32>>::Some(N) }>();
}These should lower directly to a ConstKind::Value in HIR ty lowering
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`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.