1
- use crate :: hir:: def_id:: DefId ;
2
1
use crate :: ty:: subst:: SubstsRef ;
3
2
use crate :: ty:: { CanonicalUserTypeAnnotation , ClosureSubsts , GeneratorSubsts , Ty } ;
4
3
use crate :: mir:: * ;
@@ -165,24 +164,12 @@ macro_rules! make_mir_visitor {
165
164
self . super_projection_elem( place, location) ;
166
165
}
167
166
168
- fn visit_branch( & mut self ,
169
- source: BasicBlock ,
170
- target: BasicBlock ) {
171
- self . super_branch( source, target) ;
172
- }
173
-
174
167
fn visit_constant( & mut self ,
175
168
constant: & $( $mutability) ? Constant <' tcx>,
176
169
location: Location ) {
177
170
self . super_constant( constant, location) ;
178
171
}
179
172
180
- fn visit_def_id( & mut self ,
181
- def_id: & $( $mutability) ? DefId ,
182
- _: Location ) {
183
- self . super_def_id( def_id) ;
184
- }
185
-
186
173
fn visit_span( & mut self ,
187
174
span: & $( $mutability) ? Span ) {
188
175
self . super_span( span) ;
@@ -433,120 +420,92 @@ macro_rules! make_mir_visitor {
433
420
fn super_terminator_kind( & mut self ,
434
421
kind: & $( $mutability) ? TerminatorKind <' tcx>,
435
422
source_location: Location ) {
436
- let block = source_location. block;
437
423
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 { .. } => {
440
432
}
441
433
442
434
TerminatorKind :: SwitchInt {
443
435
discr,
444
436
switch_ty,
445
437
values: _,
446
- targets
438
+ targets: _
447
439
} => {
448
440
self . visit_operand( discr, source_location) ;
449
441
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 => {
460
442
}
461
443
462
444
TerminatorKind :: Drop {
463
445
location,
464
- target,
465
- unwind,
446
+ target: _ ,
447
+ unwind: _ ,
466
448
} => {
467
449
self . visit_place(
468
450
location,
469
451
PlaceContext :: MutatingUse ( MutatingUseContext :: Drop ) ,
470
452
source_location
471
453
) ;
472
- self . visit_branch( block, * target) ;
473
- unwind. map( |t| self . visit_branch( block, t) ) ;
474
454
}
475
455
476
456
TerminatorKind :: DropAndReplace {
477
457
location,
478
458
value,
479
- target,
480
- unwind,
459
+ target: _ ,
460
+ unwind: _ ,
481
461
} => {
482
462
self . visit_place(
483
463
location,
484
464
PlaceContext :: MutatingUse ( MutatingUseContext :: Drop ) ,
485
465
source_location
486
466
) ;
487
467
self . visit_operand( value, source_location) ;
488
- self . visit_branch( block, * target) ;
489
- unwind. map( |t| self . visit_branch( block, t) ) ;
490
468
}
491
469
492
470
TerminatorKind :: Call {
493
471
func,
494
472
args,
495
473
destination,
496
- cleanup,
474
+ cleanup: _ ,
497
475
from_hir_call: _,
498
476
} => {
499
477
self . visit_operand( func, source_location) ;
500
478
for arg in args {
501
479
self . visit_operand( arg, source_location) ;
502
480
}
503
- if let Some ( ( destination, target ) ) = destination {
481
+ if let Some ( ( destination, _ ) ) = destination {
504
482
self . visit_place(
505
483
destination,
506
484
PlaceContext :: MutatingUse ( MutatingUseContext :: Call ) ,
507
485
source_location
508
486
) ;
509
- self . visit_branch( block, * target) ;
510
487
}
511
- cleanup. map( |t| self . visit_branch( block, t) ) ;
512
488
}
513
489
514
490
TerminatorKind :: Assert {
515
491
cond,
516
492
expected: _,
517
493
msg,
518
- target,
519
- cleanup,
494
+ target: _ ,
495
+ cleanup: _ ,
520
496
} => {
521
497
self . visit_operand( cond, source_location) ;
522
498
self . visit_assert_message( msg, source_location) ;
523
- self . visit_branch( block, * target) ;
524
- cleanup. map( |t| self . visit_branch( block, t) ) ;
525
499
}
526
500
527
501
TerminatorKind :: Yield {
528
502
value,
529
- resume,
530
- drop,
503
+ resume: _ ,
504
+ drop: _ ,
531
505
} => {
532
506
self . visit_operand( value, source_location) ;
533
- self . visit_branch( block, * resume) ;
534
- drop. map( |t| self . visit_branch( block, t) ) ;
535
507
}
536
508
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
- }
550
509
}
551
510
}
552
511
@@ -643,18 +602,16 @@ macro_rules! make_mir_visitor {
643
602
self . visit_substs( substs, location) ;
644
603
}
645
604
AggregateKind :: Closure (
646
- def_id ,
605
+ _ ,
647
606
closure_substs
648
607
) => {
649
- self . visit_def_id( def_id, location) ;
650
608
self . visit_closure_substs( closure_substs, location) ;
651
609
}
652
610
AggregateKind :: Generator (
653
- def_id ,
611
+ _ ,
654
612
generator_substs,
655
613
_movability,
656
614
) => {
657
- self . visit_def_id( def_id, location) ;
658
615
self . visit_generator_substs( generator_substs, location) ;
659
616
}
660
617
}
@@ -722,10 +679,7 @@ macro_rules! make_mir_visitor {
722
679
Place :: Base ( PlaceBase :: Local ( local) ) => {
723
680
self . visit_local( local, context, location) ;
724
681
}
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 } ) ) => {
729
683
self . visit_ty( & $( $mutability) ? * ty, TyContext :: Location ( location) ) ;
730
684
}
731
685
Place :: Projection ( proj) => {
@@ -805,11 +759,6 @@ macro_rules! make_mir_visitor {
805
759
_scope: & $( $mutability) ? SourceScope ) {
806
760
}
807
761
808
- fn super_branch( & mut self ,
809
- _source: BasicBlock ,
810
- _target: BasicBlock ) {
811
- }
812
-
813
762
fn super_constant( & mut self ,
814
763
constant: & $( $mutability) ? Constant <' tcx>,
815
764
location: Location ) {
@@ -826,9 +775,6 @@ macro_rules! make_mir_visitor {
826
775
self . visit_const( literal, location) ;
827
776
}
828
777
829
- fn super_def_id( & mut self , _def_id: & $( $mutability) ? DefId ) {
830
- }
831
-
832
778
fn super_span( & mut self , _span: & $( $mutability) ? Span ) {
833
779
}
834
780
0 commit comments