Leaking implementation details during unification #30
Labels
A-generic-exprs
Generic const expressions
A-unification
Unifying constants in the type system
C-design-docs
Category: This is part of our design documentation
K-impl
Document Kind: regarding implementation
P-necessary
Priority: will be needed at some point
S-active
What is this
This is a design document for const generics. Any discussions about its content should be on zulip. The conclusions of these discussions should then be edited back into this issue. Please do not post any comments directly in this issue.
Content
When unifying generic constants, we have to avoid accidentally stabilizing
parts of our lowering.
If we allow
foo
to compile, we have to guarantee that we will continue supporting itin the future. While this is fine if we intentionally allow it, it could also be allowed
by accident if we we use the same representation for
if
andmatch
in the abstract representation forgeneric constants.
Another issue here is the removal of noops, like redundant
as
-casts. This was an issue with aprevious implementation which relied on the MIR of generic constants for unification.
In general, the unification of generic constants has to add a new representation for expressions which can
be used in types. If we end up stabilizing
feature(generic_const_exprs)
with a suboptimal lifting from expressionsto that new representation, this will probably be quite difficult to fix while maintaining backwards compatability.
The text was updated successfully, but these errors were encountered: