@@ -37,7 +37,6 @@ use crate::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor};
37
37
use rustc_ast:: walk_list;
38
38
use rustc_ast:: { Attribute , Label } ;
39
39
use rustc_span:: symbol:: { Ident , Symbol } ;
40
- use rustc_span:: Span ;
41
40
42
41
pub struct DeepVisitor < ' v , V > {
43
42
visitor : & ' v mut V ,
@@ -335,13 +334,13 @@ pub trait Visitor<'v>: Sized {
335
334
fn visit_id ( & mut self , _hir_id : HirId ) {
336
335
// Nothing to do.
337
336
}
338
- fn visit_name ( & mut self , _span : Span , _name : Symbol ) {
337
+ fn visit_name ( & mut self , _name : Symbol ) {
339
338
// Nothing to do.
340
339
}
341
340
fn visit_ident ( & mut self , ident : Ident ) {
342
341
walk_ident ( self , ident)
343
342
}
344
- fn visit_mod ( & mut self , m : & ' v Mod < ' v > , _s : Span , n : HirId ) {
343
+ fn visit_mod ( & mut self , m : & ' v Mod < ' v > , n : HirId ) {
345
344
walk_mod ( self , m, n)
346
345
}
347
346
fn visit_foreign_item ( & mut self , i : & ' v ForeignItem < ' v > ) {
@@ -383,8 +382,8 @@ pub trait Visitor<'v>: Sized {
383
382
fn visit_fn_decl ( & mut self , fd : & ' v FnDecl < ' v > ) {
384
383
walk_fn_decl ( self , fd)
385
384
}
386
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , s : Span , id : HirId ) {
387
- walk_fn ( self , fk, fd, b, s , id)
385
+ fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , id : HirId ) {
386
+ walk_fn ( self , fk, fd, b, id)
388
387
}
389
388
fn visit_use ( & mut self , path : & ' v Path < ' v > , hir_id : HirId ) {
390
389
walk_use ( self , path, hir_id)
@@ -419,7 +418,6 @@ pub trait Visitor<'v>: Sized {
419
418
_: Symbol ,
420
419
_: & ' v Generics < ' v > ,
421
420
_parent_id : HirId ,
422
- _: Span ,
423
421
) {
424
422
walk_struct_def ( self , s)
425
423
}
@@ -431,7 +429,6 @@ pub trait Visitor<'v>: Sized {
431
429
enum_definition : & ' v EnumDef < ' v > ,
432
430
generics : & ' v Generics < ' v > ,
433
431
item_id : HirId ,
434
- _: Span ,
435
432
) {
436
433
walk_enum_def ( self , enum_definition, generics, item_id)
437
434
}
@@ -451,17 +448,17 @@ pub trait Visitor<'v>: Sized {
451
448
fn visit_lifetime ( & mut self , lifetime : & ' v Lifetime ) {
452
449
walk_lifetime ( self , lifetime)
453
450
}
454
- fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId , span : Span ) {
455
- walk_qpath ( self , qpath, id, span )
451
+ fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId ) {
452
+ walk_qpath ( self , qpath, id)
456
453
}
457
454
fn visit_path ( & mut self , path : & ' v Path < ' v > , _id : HirId ) {
458
455
walk_path ( self , path)
459
456
}
460
- fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment < ' v > ) {
461
- walk_path_segment ( self , path_span , path_segment)
457
+ fn visit_path_segment ( & mut self , path_segment : & ' v PathSegment < ' v > ) {
458
+ walk_path_segment ( self , path_segment)
462
459
}
463
- fn visit_generic_args ( & mut self , path_span : Span , generic_args : & ' v GenericArgs < ' v > ) {
464
- walk_generic_args ( self , path_span , generic_args)
460
+ fn visit_generic_args ( & mut self , generic_args : & ' v GenericArgs < ' v > ) {
461
+ walk_generic_args ( self , generic_args)
465
462
}
466
463
fn visit_assoc_type_binding ( & mut self , type_binding : & ' v TypeBinding < ' v > ) {
467
464
walk_assoc_type_binding ( self , type_binding)
@@ -483,7 +480,7 @@ pub trait Visitor<'v>: Sized {
483
480
484
481
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
485
482
pub fn walk_crate < ' v , V : Visitor < ' v > > ( visitor : & mut V , krate : & ' v Crate < ' v > ) {
486
- visitor. visit_mod ( & krate. item . module , krate . item . span , CRATE_HIR_ID ) ;
483
+ visitor. visit_mod ( & krate. item . module , CRATE_HIR_ID ) ;
487
484
walk_list ! ( visitor, visit_attribute, krate. item. attrs) ;
488
485
walk_list ! ( visitor, visit_macro_def, krate. exported_macros) ;
489
486
}
@@ -517,7 +514,7 @@ pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) {
517
514
}
518
515
519
516
pub fn walk_ident < ' v , V : Visitor < ' v > > ( visitor : & mut V , ident : Ident ) {
520
- visitor. visit_name ( ident. span , ident . name ) ;
517
+ visitor. visit_name ( ident. name ) ;
521
518
}
522
519
523
520
pub fn walk_label < ' v , V : Visitor < ' v > > ( visitor : & mut V , label : & ' v Label ) {
@@ -567,7 +564,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
567
564
ItemKind :: ExternCrate ( orig_name) => {
568
565
visitor. visit_id ( item. hir_id ) ;
569
566
if let Some ( orig_name) = orig_name {
570
- visitor. visit_name ( item . span , orig_name) ;
567
+ visitor. visit_name ( orig_name) ;
571
568
}
572
569
}
573
570
ItemKind :: Use ( ref path, _) => {
@@ -582,12 +579,11 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
582
579
FnKind :: ItemFn ( item. ident , generics, sig. header , & item. vis , & item. attrs ) ,
583
580
& sig. decl ,
584
581
body_id,
585
- item. span ,
586
582
item. hir_id ,
587
583
) ,
588
584
ItemKind :: Mod ( ref module) => {
589
585
// `visit_mod()` takes care of visiting the `Item`'s `HirId`.
590
- visitor. visit_mod ( module, item. span , item . hir_id )
586
+ visitor. visit_mod ( module, item. hir_id )
591
587
}
592
588
ItemKind :: ForeignMod { abi : _, items } => {
593
589
visitor. visit_id ( item. hir_id ) ;
@@ -609,7 +605,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
609
605
ItemKind :: Enum ( ref enum_definition, ref generics) => {
610
606
visitor. visit_generics ( generics) ;
611
607
// `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
612
- visitor. visit_enum_def ( enum_definition, generics, item. hir_id , item . span )
608
+ visitor. visit_enum_def ( enum_definition, generics, item. hir_id )
613
609
}
614
610
ItemKind :: Impl {
615
611
unsafety : _,
@@ -632,13 +628,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
632
628
| ItemKind :: Union ( ref struct_definition, ref generics) => {
633
629
visitor. visit_generics ( generics) ;
634
630
visitor. visit_id ( item. hir_id ) ;
635
- visitor. visit_variant_data (
636
- struct_definition,
637
- item. ident . name ,
638
- generics,
639
- item. hir_id ,
640
- item. span ,
641
- ) ;
631
+ visitor. visit_variant_data ( struct_definition, item. ident . name , generics, item. hir_id ) ;
642
632
}
643
633
ItemKind :: Trait ( .., ref generics, bounds, trait_item_refs) => {
644
634
visitor. visit_id ( item. hir_id ) ;
@@ -678,13 +668,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(
678
668
) {
679
669
visitor. visit_ident ( variant. ident ) ;
680
670
visitor. visit_id ( variant. id ) ;
681
- visitor. visit_variant_data (
682
- & variant. data ,
683
- variant. ident . name ,
684
- generics,
685
- parent_item_id,
686
- variant. span ,
687
- ) ;
671
+ visitor. visit_variant_data ( & variant. data , variant. ident . name , generics, parent_item_id) ;
688
672
walk_list ! ( visitor, visit_anon_const, & variant. disr_expr) ;
689
673
walk_list ! ( visitor, visit_attribute, variant. attrs) ;
690
674
}
@@ -708,7 +692,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
708
692
visitor. visit_fn_decl ( & function_declaration. decl ) ;
709
693
}
710
694
TyKind :: Path ( ref qpath) => {
711
- visitor. visit_qpath ( qpath, typ. hir_id , typ . span ) ;
695
+ visitor. visit_qpath ( qpath, typ. hir_id ) ;
712
696
}
713
697
TyKind :: OpaqueDef ( item_id, lifetimes) => {
714
698
visitor. visit_nested_item ( item_id) ;
@@ -729,48 +713,35 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
729
713
}
730
714
}
731
715
732
- pub fn walk_qpath < ' v , V : Visitor < ' v > > (
733
- visitor : & mut V ,
734
- qpath : & ' v QPath < ' v > ,
735
- id : HirId ,
736
- span : Span ,
737
- ) {
716
+ pub fn walk_qpath < ' v , V : Visitor < ' v > > ( visitor : & mut V , qpath : & ' v QPath < ' v > , id : HirId ) {
738
717
match * qpath {
739
718
QPath :: Resolved ( ref maybe_qself, ref path) => {
740
719
walk_list ! ( visitor, visit_ty, maybe_qself) ;
741
720
visitor. visit_path ( path, id)
742
721
}
743
722
QPath :: TypeRelative ( ref qself, ref segment) => {
744
723
visitor. visit_ty ( qself) ;
745
- visitor. visit_path_segment ( span , segment) ;
724
+ visitor. visit_path_segment ( segment) ;
746
725
}
747
726
QPath :: LangItem ( ..) => { }
748
727
}
749
728
}
750
729
751
730
pub fn walk_path < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path < ' v > ) {
752
731
for segment in path. segments {
753
- visitor. visit_path_segment ( path . span , segment) ;
732
+ visitor. visit_path_segment ( segment) ;
754
733
}
755
734
}
756
735
757
- pub fn walk_path_segment < ' v , V : Visitor < ' v > > (
758
- visitor : & mut V ,
759
- path_span : Span ,
760
- segment : & ' v PathSegment < ' v > ,
761
- ) {
736
+ pub fn walk_path_segment < ' v , V : Visitor < ' v > > ( visitor : & mut V , segment : & ' v PathSegment < ' v > ) {
762
737
visitor. visit_ident ( segment. ident ) ;
763
738
walk_list ! ( visitor, visit_id, segment. hir_id) ;
764
739
if let Some ( ref args) = segment. args {
765
- visitor. visit_generic_args ( path_span , args) ;
740
+ visitor. visit_generic_args ( args) ;
766
741
}
767
742
}
768
743
769
- pub fn walk_generic_args < ' v , V : Visitor < ' v > > (
770
- visitor : & mut V ,
771
- _path_span : Span ,
772
- generic_args : & ' v GenericArgs < ' v > ,
773
- ) {
744
+ pub fn walk_generic_args < ' v , V : Visitor < ' v > > ( visitor : & mut V , generic_args : & ' v GenericArgs < ' v > ) {
774
745
walk_list ! ( visitor, visit_generic_arg, generic_args. args) ;
775
746
walk_list ! ( visitor, visit_assoc_type_binding, generic_args. bindings) ;
776
747
}
@@ -795,14 +766,14 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) {
795
766
visitor. visit_id ( pattern. hir_id ) ;
796
767
match pattern. kind {
797
768
PatKind :: TupleStruct ( ref qpath, children, _) => {
798
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
769
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
799
770
walk_list ! ( visitor, visit_pat, children) ;
800
771
}
801
772
PatKind :: Path ( ref qpath) => {
802
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
773
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
803
774
}
804
775
PatKind :: Struct ( ref qpath, fields, _) => {
805
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
776
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
806
777
for field in fields {
807
778
visitor. visit_id ( field. hir_id ) ;
808
779
visitor. visit_ident ( field. ident ) ;
@@ -859,9 +830,9 @@ pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v GenericB
859
830
GenericBound :: Trait ( ref typ, modifier) => {
860
831
visitor. visit_poly_trait_ref ( typ, modifier) ;
861
832
}
862
- GenericBound :: LangItemTrait ( _, span , hir_id, args) => {
833
+ GenericBound :: LangItemTrait ( _, _ , hir_id, args) => {
863
834
visitor. visit_id ( hir_id) ;
864
- visitor. visit_generic_args ( span , args) ;
835
+ visitor. visit_generic_args ( args) ;
865
836
}
866
837
GenericBound :: Outlives ( ref lifetime) => visitor. visit_lifetime ( lifetime) ,
867
838
}
@@ -948,7 +919,6 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
948
919
function_kind : FnKind < ' v > ,
949
920
function_declaration : & ' v FnDecl < ' v > ,
950
921
body_id : BodyId ,
951
- _span : Span ,
952
922
id : HirId ,
953
923
) {
954
924
visitor. visit_id ( id) ;
@@ -979,7 +949,6 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
979
949
FnKind :: Method ( trait_item. ident , sig, None , & trait_item. attrs ) ,
980
950
& sig. decl ,
981
951
body_id,
982
- trait_item. span ,
983
952
trait_item. hir_id ,
984
953
) ;
985
954
}
@@ -1029,7 +998,6 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
1029
998
FnKind :: Method ( impl_item. ident , sig, Some ( & impl_item. vis ) , & impl_item. attrs ) ,
1030
999
& sig. decl ,
1031
1000
body_id,
1032
- impl_item. span ,
1033
1001
impl_item. hir_id ,
1034
1002
) ;
1035
1003
}
@@ -1113,7 +1081,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1113
1081
visitor. visit_anon_const ( count)
1114
1082
}
1115
1083
ExprKind :: Struct ( ref qpath, fields, ref optional_base) => {
1116
- visitor. visit_qpath ( qpath, expression. hir_id , expression . span ) ;
1084
+ visitor. visit_qpath ( qpath, expression. hir_id ) ;
1117
1085
for field in fields {
1118
1086
visitor. visit_id ( field. hir_id ) ;
1119
1087
visitor. visit_ident ( field. ident ) ;
@@ -1129,7 +1097,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1129
1097
walk_list ! ( visitor, visit_expr, arguments) ;
1130
1098
}
1131
1099
ExprKind :: MethodCall ( ref segment, _, arguments, _) => {
1132
- visitor. visit_path_segment ( expression . span , segment) ;
1100
+ visitor. visit_path_segment ( segment) ;
1133
1101
walk_list ! ( visitor, visit_expr, arguments) ;
1134
1102
}
1135
1103
ExprKind :: Binary ( _, ref left_expression, ref right_expression) => {
@@ -1159,7 +1127,6 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1159
1127
FnKind :: Closure ( & expression. attrs ) ,
1160
1128
function_declaration,
1161
1129
body,
1162
- expression. span ,
1163
1130
expression. hir_id ,
1164
1131
) ,
1165
1132
ExprKind :: Block ( ref block, ref opt_label) => {
@@ -1183,7 +1150,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1183
1150
visitor. visit_expr ( index_expression)
1184
1151
}
1185
1152
ExprKind :: Path ( ref qpath) => {
1186
- visitor. visit_qpath ( qpath, expression. hir_id , expression . span ) ;
1153
+ visitor. visit_qpath ( qpath, expression. hir_id ) ;
1187
1154
}
1188
1155
ExprKind :: Break ( ref destination, ref opt_expr) => {
1189
1156
walk_list ! ( visitor, visit_label, & destination. label) ;
0 commit comments