Skip to content

Commit

Permalink
Add comment and remove obsolete special case
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Nov 23, 2020
1 parent f7bf282 commit b196bec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ macro_rules! visit_place_fns {

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 {
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_mir/src/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -198,12 +198,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 {
Expand Down

0 comments on commit b196bec

Please sign in to comment.