move `Alias[Ty|Const|Term]Kind` into `Alias[Ty|Const|Term]`, generalize to not require just a `DefId`
@khyperia is already working on this.
Since Jun 2, 2026.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
ty::Ty has a Alias(AliasTyKind, DefId, GenericArgs) variant, whereas ty::Const just has Unevaluated(DefId, GenericArgs).
With mGCA we now have more than just anon consts in Unevaluated and have ways of normalizing that are not by invoking CTFE so this naming no longer makes sense. We're also starting to write code that wants to know what kind of const alias its interacting with (e.g. a projection, inherent, free, etc). This is really easy to check with types but with const generics we have to write awkward code matching on DefKinds and parents.
I expect consts will probably want to go one step further than types and have different representations for different kinds of unnormalized consts. E.g.
struct AliasConst(DefId, GenericArgs);
enum AliasConstKind {
Inherent, Projection, Free,
}
enum BikeshedConst {
ConstItem(AliasConstKind, AliasConst),
Literal(Ty, LitKind, bool),
// add stuff which was previously in `ty::ExprKind`
}
enum ConstKind {
...
// remove these
Expr(ty::Expr),
Unevaluated(ty::UnevaluatedConst),
// replace with this
Bikeshed(ty::BikeshedConst),
}
I'm not sure exactly what we should call Bikeshed/BikeshedConst, maybe just Expr works idk :3
This issue has been assigned to @khyperia via this comment.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.