Skip to content

Commit b196bec

Browse files
committed
Add comment and remove obsolete special case
1 parent f7bf282 commit b196bec

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

compiler/rustc_middle/src/mir/visit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ macro_rules! visit_place_fns {
10181018

10191019
if !place.projection.is_empty() {
10201020
if context.is_use() {
1021+
// ^ Only change the context if it is a real use, not a "use" in debuginfo.
10211022
context = if context.is_mutating_use() {
10221023
PlaceContext::MutatingUse(MutatingUseContext::Projection)
10231024
} else {

compiler/rustc_mir/src/transform/validate.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_middle::mir::traversal;
1212
use rustc_middle::mir::visit::{PlaceContext, Visitor};
1313
use rustc_middle::mir::{
1414
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceRef,
15-
Rvalue, SourceScope, Statement, StatementKind, Terminator, TerminatorKind, VarDebugInfo,
15+
Rvalue, SourceScope, Statement, StatementKind, Terminator, TerminatorKind,
1616
};
1717
use rustc_middle::ty::fold::BottomUpFolder;
1818
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeFoldable};
@@ -198,12 +198,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
198198
}
199199
}
200200

201-
fn visit_var_debug_info(&mut self, var_debug_info: &VarDebugInfo<'tcx>) {
202-
// Debuginfo can contain field projections, which count as a use of the base local. Skip
203-
// debuginfo so that we avoid the storage liveness assertion in that case.
204-
self.visit_source_info(&var_debug_info.source_info);
205-
}
206-
207201
fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
208202
// This check is somewhat expensive, so only run it when -Zvalidate-mir is passed.
209203
if self.tcx.sess.opts.debugging_opts.validate_mir {

0 commit comments

Comments
 (0)