about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-11-15 12:58:34 -0800
committerCamelid <camelidcamel@gmail.com>2020-11-15 12:58:34 -0800
commitf7bf282d9be6a0917f950e83f1856e1c5ede1a33 (patch)
tree80590c2b05b74f37e31e401a1755689dfb80714b
parent603ab5bd6e0ffefafa7411cd8bd23a6ca82bcff0 (diff)
downloadrust-f7bf282d9be6a0917f950e83f1856e1c5ede1a33.tar.gz
rust-f7bf282d9be6a0917f950e83f1856e1c5ede1a33.zip
MIR visitor: Don't treat debuginfo field access as a use of the struct
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index d8d639ab734..e9a27c82af2 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -1017,11 +1017,13 @@ macro_rules! visit_place_fns {
             let mut context = context;
 
             if !place.projection.is_empty() {
-                context = if context.is_mutating_use() {
-                    PlaceContext::MutatingUse(MutatingUseContext::Projection)
-                } else {
-                    PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
-                };
+                if context.is_use() {
+                    context = if context.is_mutating_use() {
+                        PlaceContext::MutatingUse(MutatingUseContext::Projection)
+                    } else {
+                        PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
+                    };
+                }
             }
 
             self.visit_local(&place.local, context, location);