]> git.lizzy.rs Git - rust.git/commitdiff
Add comment and remove obsolete special case
authorCamelid <camelidcamel@gmail.com>
Mon, 23 Nov 2020 01:33:06 +0000 (17:33 -0800)
committerCamelid <camelidcamel@gmail.com>
Mon, 23 Nov 2020 01:39:15 +0000 (17:39 -0800)
compiler/rustc_middle/src/mir/visit.rs
compiler/rustc_mir/src/transform/validate.rs

index e9a27c82af2b2f03c7ccff7b77e8a15de00e2872..a470c4547851f98cb8c1352eec045dda9811ee95 100644 (file)
@@ -1018,6 +1018,7 @@ fn super_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location:
 
             if !place.projection.is_empty() {
                 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 {
index 75399e9c32cc7b4e923395aa70e3dec80dc31a2c..037c446d82f59237d68255af27fe405c1209f07b 100644 (file)
@@ -12,7 +12,7 @@
 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};
@@ -198,12 +198,6 @@ fn visit_local(&mut self, local: &Local, context: PlaceContext, location: Locati
         }
     }
 
-    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 {