Turn ProjectionElem::Subtype into CastKind::Subtype#147055
Merged
bors merged 3 commits intorust-lang:masterfrom Oct 2, 2025
Merged
Turn ProjectionElem::Subtype into CastKind::Subtype#147055bors merged 3 commits intorust-lang:masterfrom
bors merged 3 commits intorust-lang:masterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that drop elaboration can't, in general, handle
ProjectionElem::SubType. It creates a disjoint move path that overlaps with other move paths. (Subslicedoes too, and I'm working on a different PR to make that special case less fragile.) If its skipped and treated as the same move path as its parent thenMovePath.placehas multiple possible projections. (It would probably make sense to remove allSubtypeprojections for the canonical place but it doesn't make sense to have this special case for a problem that doesn't actually occur in real MIR.)The only reason this doesn't break is that
Subtypeis always the sole projection of the local its applied to. For the same reason, it works fine as aCastKindso I figured that makes more sense than documenting and validating this hidden invariant.cc #112651, #133258
r? Icnr (bc you've been the main person dealing with
Subtypeit looks like)