validate: skip debuginfo

This commit is contained in:
Jonas Schievink 2020-10-02 16:50:29 +02:00
parent c1a431edc3
commit acc150b2e9

View File

@ -1,23 +1,17 @@
//! Validates the MIR to ensure that invariants are upheld. //! Validates the MIR to ensure that invariants are upheld.
use crate::{ use crate::dataflow::impls::MaybeStorageLive;
dataflow::impls::MaybeStorageLive, dataflow::Analysis, dataflow::ResultsCursor, use crate::dataflow::{Analysis, ResultsCursor};
util::storage::AlwaysLiveLocals, use crate::util::storage::AlwaysLiveLocals;
};
use super::{MirPass, MirSource}; use super::{MirPass, MirSource};
use rustc_middle::mir::{visit::PlaceContext, visit::Visitor, Local}; use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::{ use rustc_middle::mir::{
mir::{ AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, Rvalue,
AggregateKind, BasicBlock, Body, BorrowKind, Location, MirPhase, Operand, Rvalue, Statement, StatementKind, Terminator, TerminatorKind, VarDebugInfo,
Statement, StatementKind, Terminator, TerminatorKind,
},
ty::{
self,
relate::{Relate, RelateResult, TypeRelation},
ParamEnv, Ty, TyCtxt,
},
}; };
use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
enum EdgeKind { enum EdgeKind {
@ -236,6 +230,11 @@ 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.
}
fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) { fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
// `Operand::Copy` is only supposed to be used with `Copy` types. // `Operand::Copy` is only supposed to be used with `Copy` types.
if let Operand::Copy(place) = operand { if let Operand::Copy(place) = operand {