Preserve PlaceContext
through projections
#300
Labels
major-change
A proposal to make a major change to rustc
major-change-accepted
A major change proposal that was accepted
T-compiler
Add this label so rfcbot knows to poll the compiler team
TL;DR
Remove the
Projection
variants ofPlaceContext
, instead propagating the original context of the use (e.g.,Borrow
,Store
, etc.) or a newly addedDeref
variant if that place is dereferenced.Links and Details
The
visit_place
,visit_local
and similar methods on MIR visitors have access to aPlaceContext
so the visitor knows how thatPlace
orLocal
was being used without having to match onStatementKind
orTerminatorKind
themselves. However,PlaceContext
basically becomes useless as soon as projections are involved. For example, the following uses ofx.y
are all givenMutatingUseContext::Projection
, despite being very different in meaning. I want to instead preserve the original use context or a newly addedDeref
variant.This will allow more code to make use of
PlaceContext
, which is easier (and thus less prone to breakage) than manually inspecting statement or terminator kinds and/or place projections. BecauseProjection
is used for all projections, the dataflow liveness analysis for locals (which usesPlaceContext
) is not as precise as it could be.Mentors or Reviewers
???
(Not sure who "owns"
PlaceContext
)What is this issue?
This is a major change proposal, which means a proposal to make a notable change to the compiler -- one that either alters the architecture of some component, affects a lot of people, or makes a small but noticeable public change (e.g., adding a compiler flag). You can read more about the MCP process on https://forge.rust-lang.org/.
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
MCP Checklist
#t-compiler/major changes
will be created for this issue.@rustbot second
command. This should only be done by someone knowledgable with the area -- before seconding, it may be a good idea to cc other stakeholders as well and get their opinion.major-change-accepted
label is added and the issue is closed. You can link to it for future reference.A note on stability. If your change is proposing a new stable feature, such as a
-C flag
, then a full team checkoff will be required before the feature can be landed. Often it is better to start with an unstable flag, like a-Z
flag, and then move to stabilize as a secondary step.The text was updated successfully, but these errors were encountered: