mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 09:32:42 +00:00
Support `DefKind::InlineConst` in `ConstKind::Unevaluated` fixes https://github.com/rust-lang/project-const-generics/issues/101 required for https://github.com/rust-lang/project-const-generics/issues/108 consider: `Struct<{ (some, stuff, const { hi }) }>`. The following is very pseudocode-y, the important parts are whether it says AnonConst or InlineConst, not the Tuple stuff - On stable, we represent this with: `AnonConst(Tuple(some, stuff, InlineConst(hi)))` - Under mGCA, with "direct" arguments, before this PR, it was `Tuple(some, stuff, AnonConst(hi))`. The inner InlineConst got intercepted in the def_collector with hacks (`ConstArgContext`) and converted into an AnonConst, even though it has inline const syntax. It would be nice to keep it as an InlineConst under mGCA, i.e. `Tuple(some, stuff, InlineConst(hi))`, and have the type system support passing around InlineConsts in `ConstKind::Unevaluated` (soon to be renamed `ConstKind::Alias`). This would allow the def collector to not need to know if we are in a "direct" or "regular/anon" context, which it turns out is extremely useful for implementing https://github.com/rust-lang/project-const-generics/issues/108. Supporting InlineConsts in the type system are also useful for other things, for example, mentioned in https://github.com/rust-lang/project-const-generics/issues/101 is arg position const generics experiments. This PR does two things: - support InlineConsts in the type system (i.e. in `ConstKind::Unevaluated`) - exercise that support, by no longer intercepting mGCA "direct" argument inline consts to be anon consts r? @BoxyUwU