@@ -88,32 +88,28 @@ macro_rules! make_mir_visitor {
88
88
}
89
89
90
90
fn visit_statement( & mut self ,
91
- block: BasicBlock ,
92
91
statement: & $( $mutability) ? Statement <' tcx>,
93
92
location: Location ) {
94
- self . super_statement( block , statement, location) ;
93
+ self . super_statement( statement, location) ;
95
94
}
96
95
97
96
fn visit_assign( & mut self ,
98
- block: BasicBlock ,
99
97
place: & $( $mutability) ? Place <' tcx>,
100
98
rvalue: & $( $mutability) ? Rvalue <' tcx>,
101
99
location: Location ) {
102
- self . super_assign( block , place, rvalue, location) ;
100
+ self . super_assign( place, rvalue, location) ;
103
101
}
104
102
105
103
fn visit_terminator( & mut self ,
106
- block: BasicBlock ,
107
104
terminator: & $( $mutability) ? Terminator <' tcx>,
108
105
location: Location ) {
109
- self . super_terminator( block , terminator, location) ;
106
+ self . super_terminator( terminator, location) ;
110
107
}
111
108
112
109
fn visit_terminator_kind( & mut self ,
113
- block: BasicBlock ,
114
110
kind: & $( $mutability) ? TerminatorKind <' tcx>,
115
111
location: Location ) {
116
- self . super_terminator_kind( block , kind, location) ;
112
+ self . super_terminator_kind( kind, location) ;
117
113
}
118
114
119
115
fn visit_assert_message( & mut self ,
@@ -327,13 +323,13 @@ macro_rules! make_mir_visitor {
327
323
let mut index = 0 ;
328
324
for statement in statements {
329
325
let location = Location { block: block, statement_index: index } ;
330
- self . visit_statement( block , statement, location) ;
326
+ self . visit_statement( statement, location) ;
331
327
index += 1 ;
332
328
}
333
329
334
330
if let Some ( terminator) = terminator {
335
331
let location = Location { block: block, statement_index: index } ;
336
- self . visit_terminator( block , terminator, location) ;
332
+ self . visit_terminator( terminator, location) ;
337
333
}
338
334
}
339
335
@@ -350,7 +346,6 @@ macro_rules! make_mir_visitor {
350
346
}
351
347
352
348
fn super_statement( & mut self ,
353
- block: BasicBlock ,
354
349
statement: & $( $mutability) ? Statement <' tcx>,
355
350
location: Location ) {
356
351
let Statement {
@@ -361,7 +356,7 @@ macro_rules! make_mir_visitor {
361
356
self . visit_source_info( source_info) ;
362
357
match kind {
363
358
StatementKind :: Assign ( place, rvalue) => {
364
- self . visit_assign( block , place, rvalue, location) ;
359
+ self . visit_assign( place, rvalue, location) ;
365
360
}
366
361
StatementKind :: FakeRead ( _, place) => {
367
362
self . visit_place(
@@ -415,7 +410,6 @@ macro_rules! make_mir_visitor {
415
410
}
416
411
417
412
fn super_assign( & mut self ,
418
- _block: BasicBlock ,
419
413
place: & $( $mutability) ? Place <' tcx>,
420
414
rvalue: & $( $mutability) ? Rvalue <' tcx>,
421
415
location: Location ) {
@@ -428,19 +422,18 @@ macro_rules! make_mir_visitor {
428
422
}
429
423
430
424
fn super_terminator( & mut self ,
431
- block: BasicBlock ,
432
425
terminator: & $( $mutability) ? Terminator <' tcx>,
433
426
location: Location ) {
434
427
let Terminator { source_info, kind } = terminator;
435
428
436
429
self . visit_source_info( source_info) ;
437
- self . visit_terminator_kind( block , kind, location) ;
430
+ self . visit_terminator_kind( kind, location) ;
438
431
}
439
432
440
433
fn super_terminator_kind( & mut self ,
441
- block: BasicBlock ,
442
434
kind: & $( $mutability) ? TerminatorKind <' tcx>,
443
435
source_location: Location ) {
436
+ let block = source_location. block;
444
437
match kind {
445
438
TerminatorKind :: Goto { target } => {
446
439
self . visit_branch( block, * target) ;
@@ -890,12 +883,12 @@ macro_rules! make_mir_visitor {
890
883
let basic_block = & $( $mutability) ? mir[ location. block] ;
891
884
if basic_block. statements. len( ) == location. statement_index {
892
885
if let Some ( ref $( $mutability) ? terminator) = basic_block. terminator {
893
- self . visit_terminator( location . block , terminator, location)
886
+ self . visit_terminator( terminator, location)
894
887
}
895
888
} else {
896
889
let statement = & $( $mutability) ?
897
890
basic_block. statements[ location. statement_index] ;
898
- self . visit_statement( location . block , statement, location)
891
+ self . visit_statement( statement, location)
899
892
}
900
893
}
901
894
}
@@ -912,21 +905,21 @@ pub trait MirVisitable<'tcx> {
912
905
impl < ' tcx > MirVisitable < ' tcx > for Statement < ' tcx > {
913
906
fn apply ( & self , location : Location , visitor : & mut dyn Visitor < ' tcx > )
914
907
{
915
- visitor. visit_statement ( location . block , self , location)
908
+ visitor. visit_statement ( self , location)
916
909
}
917
910
}
918
911
919
912
impl < ' tcx > MirVisitable < ' tcx > for Terminator < ' tcx > {
920
913
fn apply ( & self , location : Location , visitor : & mut dyn Visitor < ' tcx > )
921
914
{
922
- visitor. visit_terminator ( location . block , self , location)
915
+ visitor. visit_terminator ( self , location)
923
916
}
924
917
}
925
918
926
919
impl < ' tcx > MirVisitable < ' tcx > for Option < Terminator < ' tcx > > {
927
920
fn apply ( & self , location : Location , visitor : & mut dyn Visitor < ' tcx > )
928
921
{
929
- visitor. visit_terminator ( location . block , self . as_ref ( ) . unwrap ( ) , location)
922
+ visitor. visit_terminator ( self . as_ref ( ) . unwrap ( ) , location)
930
923
}
931
924
}
932
925
0 commit comments