-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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-adt_const_params`#![feature(adt_const_params)]``#![feature(adt_const_params)]`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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
WellFormed goals for const generics currently don't require that the constituent consts of an array valtree have the same type as the element type of the valtree. This allows the following code to pass even though Bar is not of type Foo:
#![feature(adt_const_params, min_generic_const_args)]
use std::marker::ConstParamTy;
#[derive(Eq, PartialEq, ConstParamTy)]
struct Foo;
struct Bar;
fn foo<const N: [Foo; 1]>() {}
fn main() {
foo::<{ [Bar] }>();
}See #150713 as an example of where this was previously implemented for tuples. Implementing this will involve extending the Tuple arm to also cover Arrays.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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-adt_const_params`#![feature(adt_const_params)]``#![feature(adt_const_params)]`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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.