From f7bf282d9be6a0917f950e83f1856e1c5ede1a33 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sun, 15 Nov 2020 12:58:34 -0800 Subject: [PATCH] MIR visitor: Don't treat debuginfo field access as a use of the struct --- compiler/rustc_middle/src/mir/visit.rs | 12 +++++++----- 1 file 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);