1
Fork 0

Rollup merge of #79080 - camelid:mir-visit-debuginfo-project, r=jonas-schievink

MIR visitor: Don't treat debuginfo field access as a use of the struct

Fixes #77454.

r? `@jonas-schievink`
This commit is contained in:
Jonas Schievink 2020-11-23 15:25:40 +01:00 committed by GitHub
commit d4a05696d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View file

@ -1017,11 +1017,14 @@ 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() {
// ^ Only change the context if it is a real use, not a "use" in debuginfo.
context = if context.is_mutating_use() {
PlaceContext::MutatingUse(MutatingUseContext::Projection)
} else {
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
};
}
}
self.visit_local(&place.local, context, location);