about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-10-02 16:50:29 +0200
committerJonas Schievink <jonasschievink@gmail.com>2020-10-02 16:50:29 +0200
commitacc150b2e9b24965e3a8ff6a8dc539706874190b (patch)
tree85566b010b4436a0388f563a0786007c7b2b98b1
parentc1a431edc3333b95b432aa61fb0fdb1db470b86d (diff)
downloadrust-acc150b2e9b24965e3a8ff6a8dc539706874190b.tar.gz
rust-acc150b2e9b24965e3a8ff6a8dc539706874190b.zip
validate: skip debuginfo
-rw-r--r--compiler/rustc_mir/src/transform/validate.rs29
1 files changed, 14 insertions, 15 deletions
diff --git a/compiler/rustc_mir/src/transform/validate.rs b/compiler/rustc_mir/src/transform/validate.rs
index d1a91ae4fc3..ba7554cf02b 100644
--- a/compiler/rustc_mir/src/transform/validate.rs
+++ b/compiler/rustc_mir/src/transform/validate.rs
@@ -1,23 +1,17 @@
 //! Validates the MIR to ensure that invariants are upheld.
 
-use crate::{
-    dataflow::impls::MaybeStorageLive, dataflow::Analysis, dataflow::ResultsCursor,
-    util::storage::AlwaysLiveLocals,
-};
+use crate::dataflow::impls::MaybeStorageLive;
+use crate::dataflow::{Analysis, ResultsCursor};
+use crate::util::storage::AlwaysLiveLocals;
 
 use super::{MirPass, MirSource};
-use rustc_middle::mir::{visit::PlaceContext, visit::Visitor, Local};
-use rustc_middle::{
-    mir::{
-        AggregateKind, BasicBlock, Body, BorrowKind, Location, MirPhase, Operand, Rvalue,
-        Statement, StatementKind, Terminator, TerminatorKind,
-    },
-    ty::{
-        self,
-        relate::{Relate, RelateResult, TypeRelation},
-        ParamEnv, Ty, TyCtxt,
-    },
+use rustc_middle::mir::visit::{PlaceContext, Visitor};
+use rustc_middle::mir::{
+    AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, Rvalue,
+    Statement, StatementKind, Terminator, TerminatorKind, VarDebugInfo,
 };
+use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
+use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
 
 #[derive(Copy, Clone, Debug)]
 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) {
         // `Operand::Copy` is only supposed to be used with `Copy` types.
         if let Operand::Copy(place) = operand {