Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[RFC] Refactor types to be a `(TypeCore, Substs)` pair #42340
Comments
nikomatsakis
added
the
T-compiler
label
May 31, 2017
This comment has been minimized.
This comment has been minimized.
|
just a heads up - #42171 isn't closed yet (only half of it), though I'm planning on getting to the other half this week. |
This comment has been minimized.
This comment has been minimized.
|
@tschottdorf ah yeah, I was thinking of the "check" as "in progress", but ... seems fine |
Mark-Simulacrum
added
the
C-cleanup
label
Jul 27, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nikomatsakis commentedMay 31, 2017
•
edited by Mark-Simulacrum
Currently, the
Ty<'tcx>type is a reference to a struct (&TyS) that packages up a big ol' enumTypeVariants. As part of chalkification, we would like to be able to write more efficient "decision tree" like procedures that branch on this type. This would be made nicer by factoring out the type into two parts, a "core" and a "substs". This core would be roughly equivalent to the existingTypeVariants, but without the recursive references to other types, which would be uniformly packaged up in thesubsts.Thus I imagine that the
TySstruct would change to something like this:(Incidentally, this new notion of
TypeVariantscould maybe subsume the existingSimplifiedType, though that's not super important.)Steps
This transition is best made in steps:
TyTupleto use a substsClosureSubststype used inTyClosureand make it into a normal substsUnknowns
It's not 100% clear that this is a good plan, though the individual refactorings above all seem like good steps regardless. Some complicating factors:
TyFnPtrembodies aPolyFnSig, which carries a binder.cc @eddyb, who first suggested this to me
cc @tschottdorf, who implemented #42297, a step along this path (and an important step for ATC regardless)