Skip to content

Turn ProjectionElem::Subtype into CastKind::Subtype#147055

Merged
bors merged 3 commits intorust-lang:masterfrom
beepster4096:subtype_is_not_a_projection
Oct 2, 2025
Merged

Turn ProjectionElem::Subtype into CastKind::Subtype#147055
bors merged 3 commits intorust-lang:masterfrom
beepster4096:subtype_is_not_a_projection

Conversation

@beepster4096
Copy link
Copy Markdown
Contributor

@beepster4096 beepster4096 commented Sep 26, 2025

I noticed that drop elaboration can't, in general, handle ProjectionElem::SubType. It creates a disjoint move path that overlaps with other move paths. (Subslice does 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 then MovePath.place has multiple possible projections. (It would probably make sense to remove all Subtype projections 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 Subtype is always the sole projection of the local its applied to. For the same reason, it works fine as a CastKind so 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 Subtype it looks like)

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants