-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Description
This is a tracking issue for the prototype described in rust-lang/rust-project-goals#100. Background reading as to the design/justification for this feature.
The feature gate for the issue is #![feature(min_generic_const_args)].
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Add
ConstArgKind::Path(Represent type-level consts with new-and-improvedhir::ConstArg#125915) - Use
ConstArgKind::Pathfor all single-segment paths (UseConstArgKind::Pathfor all single-segment paths, not just params undermin_generic_const_args#131081) - Use
ConstArgKind::Pathfor all paths - Support "simple" exprs necessary for constructing
adt_const_paramstypes:- Struct construction exprs, e.g.
Adt { field: N } - Tuple constructor calls, e.g.
Some(N)MGCA: support tuple constructor calls as a direct const argument #150610 - Const constructs, e.g.
NoneSupportConstArgKind::Paths for const struct/variant constructors #132985 - Array exprs, e.g.
[M; N],[1, 2, N]MGCA: Support array expressions as direct const arguments #150612 - Tuple exprs,
(10, N)MGCA: Support tuple expressions as direct const arguments #150613
- Struct construction exprs, e.g.
- reject impls not using #[type_const] on their assoc consts if the trait used it mgca: Finish implementation of
#[type_const]#148716 - enforce type_const marked const items have a type that implements ConstParamTy mgca: Finish implementation of
#[type_const]#148716 - forbid generic parameters from being used in the types of const parameters MGCA: forbid generic parameters from being in used in the types of type_const items #150614
- lower uses of
type_consts tomir::Const::Tyso they can be normalized in the MIR correctly MGCA: uses of type_const items inside of bodies should lower tomir::Const::Ty#150615 - Make inherent associated constants behave correctly
- Implement type system normalization that makes use of
associated_const_equalitybounds mgca: Add ConstArg representation for const items #139558 - Merge
feature(associated_const_equality)intomin_generic_const_argsMGCA: mergeassociated_const_equalityfeature gate into MGCA #150617 - Experiment with adding some kind of
ConstArgKind::LiteralMGCA: Support literals as direct const arguments #150618 - Traits are dyn compatible if all associated consts are type safe Permit trait object types where all (non-generic) associated constants are specified (via assoc item bindings) #130300
- Find a way to avoid code duplication between HIR ty lowering and typechecking for struct expressions MGCA: Avoid code duplication between HIR ty lowering and elsewhere #150621
- Make HIR ty lowering lower uses of generic parameters to errors if in an item with no generics
- Find better names for
ConstKind::ValueandValTreenow that they're not fully evaluated Followup work from makingValTreerecurse throughty::Const#150624 - Do something about CTFE returning ValTrees with erased lifetimes. Likely means adding a
ValTreewhich doesn't recurse throughty::Constlike how it used to be Followup work from makingValTreerecurse throughty::Const#150624 - Typecheck that const arguments outside of paths have the correct type MGCA: Check that const arguments in struct exprs are correctly typed #150623
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
TODO
Implementation history
- Initial document proposing the design/feature hackmd link
- Represent type-level consts with new-and-improved
hir::ConstArg#125915 - Fix anon const def-creation when macros are involved #129137
- Use
ConstArgKind::Pathfor all single-segment paths, not just params undermin_generic_const_args#131081 - Encode MIR for const ctors in metadata and allow eval for them #134873
- mgca: Lower all const paths as
ConstArgKind::Path#135186 - Set groundwork for proper const normalization #140549
- mgca: Add ConstArg representation for const items #139558
- mgca: Finish implementation of
#[type_const]#148716 - MGCA: Syntactically distinguish anon const const args #149136
- dont create unnecessary
DefIds under mgca #150025 - MGCA: Support struct expressions without intermediary anon consts #149114
- avoid recreating field_const vec #150380
- refactor
destructure_const#150411 - Use more principled check for generics in const ops #150519
- Remove unneeded
forbid_genericfield fromRes::SelfTyAlias#150589 - MGCA: Support for tuple constructors #150603
- Forbid generic parameters in types of #[type_const] items #150650
- MGCA: Support tuple expressions as direct const arguments #150675
- Merge
associated_const_equalityfeature gate into MGCA #150640- This tracking issue now inherits the impl history of ACE's tracking issue Tracking issue for associated const equality #92827
- allow eq constraints on associated constants #876481
- Continue work on associated const equality #932852
- Resolve associated item bindings by namespace #118668
- Fix type resolution of associated const equality bounds (take 2) #119385
- Reject overly generic assoc const binding types #121258
- MGCA: Support literals as direct const arguments #150699
- MGCA: Const constructors support #150704
- MGCA: pretty printing for struct expressions and tuple calls #150695
- mgca: Type-check fields of struct expr const args #150713