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

@ -12,7 +12,7 @@ use rustc_middle::mir::traversal;
use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::{
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceRef,
Rvalue, SourceScope, Statement, StatementKind, Terminator, TerminatorKind, VarDebugInfo,
Rvalue, SourceScope, Statement, StatementKind, Terminator, TerminatorKind,
};
use rustc_middle::ty::fold::BottomUpFolder;
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeFoldable};
@ -200,12 +200,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
}
}
fn visit_var_debug_info(&mut self, var_debug_info: &VarDebugInfo<'tcx>) {
// Debuginfo can contain field projections, which count as a use of the base local. Skip
// debuginfo so that we avoid the storage liveness assertion in that case.
self.visit_source_info(&var_debug_info.source_info);
}
fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
// This check is somewhat expensive, so only run it when -Zvalidate-mir is passed.
if self.tcx.sess.opts.debugging_opts.validate_mir {