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.
ty::Tyhas aAlias(AliasTyKind, DefId, GenericArgs)variant, whereasty::Constjust hasUnevaluated(DefId, GenericArgs).With mGCA we now have more than just anon consts in
Unevaluatedand 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 onDefKinds 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.
I'm not sure exactly what we should call
Bikeshed/BikeshedConst, maybe justExprworks idk :3This issue has been assigned to @khyperia via this comment.