Introduce PlaceContext::may_observe_address.
This commit is contained in:
committed by
Camille Gillot
parent
bea625f327
commit
4e7a068c9a
@@ -225,6 +225,9 @@ impl SsaVisitor<'_, '_> {
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for SsaVisitor<'_, 'tcx> {
|
||||
fn visit_local(&mut self, local: Local, ctxt: PlaceContext, loc: Location) {
|
||||
if ctxt.may_observe_address() {
|
||||
self.borrowed_locals.insert(local);
|
||||
}
|
||||
match ctxt {
|
||||
PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
||||
| PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) => bug!(),
|
||||
@@ -237,7 +240,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor<'_, 'tcx> {
|
||||
PlaceContext::NonMutatingUse(
|
||||
NonMutatingUseContext::SharedBorrow | NonMutatingUseContext::FakeBorrow,
|
||||
) => {
|
||||
self.borrowed_locals.insert(local);
|
||||
self.check_dominates(local, loc);
|
||||
self.direct_uses[local] += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user