-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Refactor types to be a (TypeCore, Substs)
pair
#42340
Comments
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. |
@tschottdorf ah yeah, I was thinking of the "check" as "in progress", but ... seems fine |
Replace the `&'tcx List<Ty<'tcx>>` in `TyKind::Tuple` with `SubstsRef<'tcx>` Part of the suggested refactoring for rust-lang#42340. As expected, this is a little messy, because there are many places that the components of tuples are expected to be types, rather than arbitrary kinds. However, it should open up the way for a refactoring of `TyS` itself. r? @nikomatsakis
Replace the `&'tcx List<Ty<'tcx>>` in `TyKind::Tuple` with `SubstsRef<'tcx>` Part of the suggested refactoring for rust-lang#42340. As expected, this is a little messy, because there are many places that the components of tuples are expected to be types, rather than arbitrary kinds. However, it should open up the way for a refactoring of `TyS` itself. r? @nikomatsakis
Replace the `&'tcx List<Ty<'tcx>>` in `TyKind::Tuple` with `SubstsRef<'tcx>` Part of the suggested refactoring for rust-lang#42340. As expected, this is a little messy, because there are many places that the components of tuples are expected to be types, rather than arbitrary kinds. However, it should open up the way for a refactoring of `TyS` itself. r? @nikomatsakis
Replace ClosureSubsts with SubstsRef Addresses rust-lang#42340 part 3 rust-lang#59312 might benefit from this clean up. r? @nikomatsakis
Could they be moved to the binder? |
Replace GeneratorSubsts with SubstsRef Closes rust-lang#42340 r? @nikomatsakis
Replace GeneratorSubsts with SubstsRef Closes rust-lang#42340 r? @nikomatsakis
Replace GeneratorSubsts with SubstsRef Closes rust-lang#42340 r? @nikomatsakis
Replace GeneratorSubsts with SubstsRef Closes rust-lang#42340 r? @nikomatsakis
@nikomatsakis @eddyb not sure whether this issue should be closed or not. How about those |
This isn't done, the checkboxes were only for prerequisites, I think. |
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
TyS
struct would change to something like this:(Incidentally, this new notion of
TypeVariants
could maybe subsume the existingSimplifiedType
, though that's not super important.)Steps
This transition is best made in steps:
TyTuple
to use a substsClosureSubsts
type used inTyClosure
and make it into a normal substsGeneratorSubsts
]Unknowns
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:
TyFnPtr
embodies 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)
The text was updated successfully, but these errors were encountered: