Skip to content

MIR MutVisitor::visit_local cannot mutate all Locals #71008

Description

@jonas-schievink

Specifically, when a ProjectionElem::Index is encountered, the contained Local is not passed to visit_local, requiring the MutVisitor to also implement process_projection_elem.

This is a footgun that may cause unsound MIR transforms, which is what happened to me while working on #71003. The CopyProp pass also has to explicitly implement process_projection_elem to be sound.

Activity

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

Metadata

Metadata

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions