Skip to content

Commit d64bd3b

Browse files
authored
Rollup merge of rust-lang#136722 - kornelski:visit-spans, r=chenyukang
Visit all debug info in MIR Visitor I've been experimenting with simplifying debug info in MIR inliner, and discovered that MIR Visitor doesn't reliably visit all spans. This PR adds the missing visitor calls.
2 parents 370c8af + da4cf03 commit d64bd3b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: compiler/rustc_middle/src/mir/visit.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ macro_rules! make_mir_visitor {
527527
target: _,
528528
unwind: _,
529529
call_source: _,
530-
fn_span: _
530+
fn_span,
531531
} => {
532+
self.visit_span($(& $mutability)? *fn_span);
532533
self.visit_operand(func, location);
533534
for arg in args {
534535
self.visit_operand(&$($mutability)? arg.node, location);
@@ -543,8 +544,9 @@ macro_rules! make_mir_visitor {
543544
TerminatorKind::TailCall {
544545
func,
545546
args,
546-
fn_span: _,
547+
fn_span,
547548
} => {
549+
self.visit_span($(& $mutability)? *fn_span);
548550
self.visit_operand(func, location);
549551
for arg in args {
550552
self.visit_operand(&$($mutability)? arg.node, location);
@@ -853,6 +855,8 @@ macro_rules! make_mir_visitor {
853855
local_info: _,
854856
} = local_decl;
855857

858+
self.visit_source_info(source_info);
859+
856860
self.visit_ty($(& $mutability)? *ty, TyContext::LocalDecl {
857861
local,
858862
source_info: *source_info,
@@ -862,7 +866,6 @@ macro_rules! make_mir_visitor {
862866
self.visit_user_type_projection(user_ty);
863867
}
864868
}
865-
self.visit_source_info(source_info);
866869
}
867870

868871
fn super_var_debug_info(

Diff for: compiler/rustc_mir_transform/src/inline.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
12571257
// replaced down below anyways).
12581258
if !matches!(terminator.kind, TerminatorKind::Return) {
12591259
self.super_terminator(terminator, loc);
1260+
} else {
1261+
self.visit_source_info(&mut terminator.source_info);
12601262
}
12611263

12621264
match terminator.kind {

0 commit comments

Comments
 (0)