Skip to content

Commit 4e69d37

Browse files
committed
Remove unused MIR visitor methods
1 parent 22226fa commit 4e69d37

File tree

1 file changed

+22
-76
lines changed

1 file changed

+22
-76
lines changed

src/librustc/mir/visit.rs

+22-76
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::hir::def_id::DefId;
21
use crate::ty::subst::SubstsRef;
32
use crate::ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Ty};
43
use crate::mir::*;
@@ -165,24 +164,12 @@ macro_rules! make_mir_visitor {
165164
self.super_projection_elem(place, location);
166165
}
167166

168-
fn visit_branch(&mut self,
169-
source: BasicBlock,
170-
target: BasicBlock) {
171-
self.super_branch(source, target);
172-
}
173-
174167
fn visit_constant(&mut self,
175168
constant: & $($mutability)? Constant<'tcx>,
176169
location: Location) {
177170
self.super_constant(constant, location);
178171
}
179172

180-
fn visit_def_id(&mut self,
181-
def_id: & $($mutability)? DefId,
182-
_: Location) {
183-
self.super_def_id(def_id);
184-
}
185-
186173
fn visit_span(&mut self,
187174
span: & $($mutability)? Span) {
188175
self.super_span(span);
@@ -433,120 +420,92 @@ macro_rules! make_mir_visitor {
433420
fn super_terminator_kind(&mut self,
434421
kind: & $($mutability)? TerminatorKind<'tcx>,
435422
source_location: Location) {
436-
let block = source_location.block;
437423
match kind {
438-
TerminatorKind::Goto { target } => {
439-
self.visit_branch(block, *target);
424+
TerminatorKind::Goto { .. } |
425+
TerminatorKind::Resume |
426+
TerminatorKind::Abort |
427+
TerminatorKind::Return |
428+
TerminatorKind::GeneratorDrop |
429+
TerminatorKind::Unreachable |
430+
TerminatorKind::FalseEdges { .. } |
431+
TerminatorKind::FalseUnwind { .. } => {
440432
}
441433

442434
TerminatorKind::SwitchInt {
443435
discr,
444436
switch_ty,
445437
values: _,
446-
targets
438+
targets: _
447439
} => {
448440
self.visit_operand(discr, source_location);
449441
self.visit_ty(switch_ty, TyContext::Location(source_location));
450-
for target in targets {
451-
self.visit_branch(block, *target);
452-
}
453-
}
454-
455-
TerminatorKind::Resume |
456-
TerminatorKind::Abort |
457-
TerminatorKind::Return |
458-
TerminatorKind::GeneratorDrop |
459-
TerminatorKind::Unreachable => {
460442
}
461443

462444
TerminatorKind::Drop {
463445
location,
464-
target,
465-
unwind,
446+
target: _,
447+
unwind: _,
466448
} => {
467449
self.visit_place(
468450
location,
469451
PlaceContext::MutatingUse(MutatingUseContext::Drop),
470452
source_location
471453
);
472-
self.visit_branch(block, *target);
473-
unwind.map(|t| self.visit_branch(block, t));
474454
}
475455

476456
TerminatorKind::DropAndReplace {
477457
location,
478458
value,
479-
target,
480-
unwind,
459+
target: _,
460+
unwind: _,
481461
} => {
482462
self.visit_place(
483463
location,
484464
PlaceContext::MutatingUse(MutatingUseContext::Drop),
485465
source_location
486466
);
487467
self.visit_operand(value, source_location);
488-
self.visit_branch(block, *target);
489-
unwind.map(|t| self.visit_branch(block, t));
490468
}
491469

492470
TerminatorKind::Call {
493471
func,
494472
args,
495473
destination,
496-
cleanup,
474+
cleanup: _,
497475
from_hir_call: _,
498476
} => {
499477
self.visit_operand(func, source_location);
500478
for arg in args {
501479
self.visit_operand(arg, source_location);
502480
}
503-
if let Some((destination, target)) = destination {
481+
if let Some((destination, _)) = destination {
504482
self.visit_place(
505483
destination,
506484
PlaceContext::MutatingUse(MutatingUseContext::Call),
507485
source_location
508486
);
509-
self.visit_branch(block, *target);
510487
}
511-
cleanup.map(|t| self.visit_branch(block, t));
512488
}
513489

514490
TerminatorKind::Assert {
515491
cond,
516492
expected: _,
517493
msg,
518-
target,
519-
cleanup,
494+
target: _,
495+
cleanup: _,
520496
} => {
521497
self.visit_operand(cond, source_location);
522498
self.visit_assert_message(msg, source_location);
523-
self.visit_branch(block, *target);
524-
cleanup.map(|t| self.visit_branch(block, t));
525499
}
526500

527501
TerminatorKind::Yield {
528502
value,
529-
resume,
530-
drop,
503+
resume: _,
504+
drop: _,
531505
} => {
532506
self.visit_operand(value, source_location);
533-
self.visit_branch(block, *resume);
534-
drop.map(|t| self.visit_branch(block, t));
535507
}
536508

537-
TerminatorKind::FalseEdges { real_target, imaginary_targets } => {
538-
self.visit_branch(block, *real_target);
539-
for target in imaginary_targets {
540-
self.visit_branch(block, *target);
541-
}
542-
}
543-
544-
TerminatorKind::FalseUnwind { real_target, unwind } => {
545-
self.visit_branch(block, *real_target);
546-
if let Some(unwind) = unwind {
547-
self.visit_branch(block, *unwind);
548-
}
549-
}
550509
}
551510
}
552511

@@ -643,18 +602,16 @@ macro_rules! make_mir_visitor {
643602
self.visit_substs(substs, location);
644603
}
645604
AggregateKind::Closure(
646-
def_id,
605+
_,
647606
closure_substs
648607
) => {
649-
self.visit_def_id(def_id, location);
650608
self.visit_closure_substs(closure_substs, location);
651609
}
652610
AggregateKind::Generator(
653-
def_id,
611+
_,
654612
generator_substs,
655613
_movability,
656614
) => {
657-
self.visit_def_id(def_id, location);
658615
self.visit_generator_substs(generator_substs, location);
659616
}
660617
}
@@ -722,10 +679,7 @@ macro_rules! make_mir_visitor {
722679
Place::Base(PlaceBase::Local(local)) => {
723680
self.visit_local(local, context, location);
724681
}
725-
Place::Base(PlaceBase::Static(box Static { kind, ty })) => {
726-
if let StaticKind::Static(def_id) = kind {
727-
self.visit_def_id(& $($mutability)? *def_id, location)
728-
}
682+
Place::Base(PlaceBase::Static(box Static { kind: _, ty })) => {
729683
self.visit_ty(& $($mutability)? *ty, TyContext::Location(location));
730684
}
731685
Place::Projection(proj) => {
@@ -805,11 +759,6 @@ macro_rules! make_mir_visitor {
805759
_scope: & $($mutability)? SourceScope) {
806760
}
807761

808-
fn super_branch(&mut self,
809-
_source: BasicBlock,
810-
_target: BasicBlock) {
811-
}
812-
813762
fn super_constant(&mut self,
814763
constant: & $($mutability)? Constant<'tcx>,
815764
location: Location) {
@@ -826,9 +775,6 @@ macro_rules! make_mir_visitor {
826775
self.visit_const(literal, location);
827776
}
828777

829-
fn super_def_id(&mut self, _def_id: & $($mutability)? DefId) {
830-
}
831-
832778
fn super_span(&mut self, _span: & $($mutability)? Span) {
833779
}
834780

0 commit comments

Comments
 (0)