Skip to content

Commit f7bf282

Browse files
committed
MIR visitor: Don't treat debuginfo field access as a use of the struct
1 parent 603ab5b commit f7bf282

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,13 @@ macro_rules! visit_place_fns {
10171017
let mut context = context;
10181018

10191019
if !place.projection.is_empty() {
1020-
context = if context.is_mutating_use() {
1021-
PlaceContext::MutatingUse(MutatingUseContext::Projection)
1022-
} else {
1023-
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
1024-
};
1020+
if context.is_use() {
1021+
context = if context.is_mutating_use() {
1022+
PlaceContext::MutatingUse(MutatingUseContext::Projection)
1023+
} else {
1024+
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
1025+
};
1026+
}
10251027
}
10261028

10271029
self.visit_local(&place.local, context, location);

0 commit comments

Comments
 (0)