Repository navigation
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-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)`#![feature(gca_min_const_items)]` (previously: `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
Currently the wellformedness requirements of ty::Const does not require that ty::Const as the fields of ADTs have the type of the ADT's field. See this test
rust/tests/ui/const-generics/mgca/adt_expr_fields_type_check.rs
Lines 4 to 15 in 5497a36
| #![feature(min_generic_const_args, adt_const_params)] | |
| #![expect(incomplete_features)] | |
| #[derive(Eq, PartialEq, std::marker::ConstParamTy)] | |
| struct Foo<T> { field: T } | |
| fn accepts<const N: Foo<u8>>() {} | |
| fn bar<const N: bool>() { | |
| // `N` is not of type `u8` but we don't actually check this anywhere yet | |
| accepts::<{ Foo::<u8> { field: N }}>(); | |
| } |
To fix this we should update wf::obligations for ty::Const to emit ConstArgHasType goals for ty::Consts in ValTreeKind::Branch according to the type of their parent ValTree node.
cc @camelid I've assigned you as we've talked about you implementing this on zulip
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-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)`#![feature(gca_min_const_items)]` (previously: `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.
Activity
Rollup merge of rust-lang#150713 - mgca-typeck-struct-fields, r=BoxyUwU
Rollup merge of rust-lang#150713 - mgca-typeck-struct-fields, r=BoxyUwU
Rollup merge of rust-lang#150713 - mgca-typeck-struct-fields, r=BoxyUwU
Rollup merge of rust-lang#150713 - mgca-typeck-struct-fields, r=BoxyUwU
Unrolled build for #150713