Skip to content

Commit

Permalink
Auto merge of #117517 - klinvill:smir-projections, r=ouz-a
Browse files Browse the repository at this point in the history
Add richer structure for Stable MIR Projections

Resolves rust-lang/project-stable-mir#49.

Projections in Stable MIR are currently just strings. This PR replaces that representation with a richer structure, namely projections become vectors of `ProjectionElem`s, just as in MIR. The `ProjectionElem` enum is heavily based off of the MIR `ProjectionElem`.

This PR is a draft since there are several outstanding issues to resolve, including:

- How should `UserTypeProjection`s be represented in Stable MIR? In MIR, the projections are just a vector of `ProjectionElem<(),()>`, meaning `ProjectionElem`s that don't have Local or Type arguments (for `Index`, `Field`, etc. objects). Should `UserTypeProjection`s be represented this way in Stable MIR as well? Or is there a more user-friendly representation that wouldn't drag along all the `ProjectionElem` variants that presumably can't appear?
- What is the expected behavior of a `Place`'s `ty` function? Should it resolve down the chain of projections so that something like `*_1.f` would return the type referenced by field `f`?
- Tests should be added for `UserTypeProjection`
  • Loading branch information
bors committed Nov 15, 2023
2 parents 5c7466f + 0b4f93e commit 268957f
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 268957f

Please sign in to comment.