|
1 | 1 | //! Validates the MIR to ensure that invariants are upheld.
|
2 | 2 |
|
3 |
| -use crate::{ |
4 |
| - dataflow::impls::MaybeStorageLive, dataflow::Analysis, dataflow::ResultsCursor, |
5 |
| - util::storage::AlwaysLiveLocals, |
6 |
| -}; |
| 3 | +use crate::dataflow::impls::MaybeStorageLive; |
| 4 | +use crate::dataflow::{Analysis, ResultsCursor}; |
| 5 | +use crate::util::storage::AlwaysLiveLocals; |
7 | 6 |
|
8 | 7 | use super::{MirPass, MirSource};
|
9 |
| -use rustc_middle::mir::{visit::PlaceContext, visit::Visitor, Local}; |
10 |
| -use rustc_middle::{ |
11 |
| - mir::{ |
12 |
| - AggregateKind, BasicBlock, Body, BorrowKind, Location, MirPhase, Operand, Rvalue, |
13 |
| - Statement, StatementKind, Terminator, TerminatorKind, |
14 |
| - }, |
15 |
| - ty::{ |
16 |
| - self, |
17 |
| - relate::{Relate, RelateResult, TypeRelation}, |
18 |
| - ParamEnv, Ty, TyCtxt, |
19 |
| - }, |
| 8 | +use rustc_middle::mir::visit::{PlaceContext, Visitor}; |
| 9 | +use rustc_middle::mir::{ |
| 10 | + AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, Rvalue, |
| 11 | + Statement, StatementKind, Terminator, TerminatorKind, VarDebugInfo, |
20 | 12 | };
|
| 13 | +use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation}; |
| 14 | +use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt}; |
21 | 15 |
|
22 | 16 | #[derive(Copy, Clone, Debug)]
|
23 | 17 | enum EdgeKind {
|
@@ -236,6 +230,11 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
236 | 230 | }
|
237 | 231 | }
|
238 | 232 |
|
| 233 | + fn visit_var_debug_info(&mut self, _var_debug_info: &VarDebugInfo<'tcx>) { |
| 234 | + // Debuginfo can contain field projections, which count as a use of the base local. Skip |
| 235 | + // debuginfo so that we avoid the storage liveness assertion in that case. |
| 236 | + } |
| 237 | + |
239 | 238 | fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
|
240 | 239 | // `Operand::Copy` is only supposed to be used with `Copy` types.
|
241 | 240 | if let Operand::Copy(place) = operand {
|
|
0 commit comments