@@ -25,7 +25,6 @@ use rustc_middle::hir::nested_filter;
2525use rustc_middle:: span_bug;
2626use rustc_middle:: ty:: { self , DefIdTree , TyCtxt } ;
2727use rustc_session:: config:: Input ;
28- use rustc_span:: source_map:: respan;
2928use rustc_span:: symbol:: Ident ;
3029use rustc_span:: * ;
3130
@@ -65,12 +64,6 @@ macro_rules! access_from {
6564 } ;
6665}
6766
68- macro_rules! access_from_vis {
69- ( $save_ctxt: expr, $vis: expr, $id: expr) => {
70- Access { public: $vis. node. is_pub( ) , reachable: $save_ctxt. access_levels. is_reachable( $id) }
71- } ;
72- }
73-
7467pub struct DumpVisitor < ' tcx > {
7568 pub save_ctxt : SaveContext < ' tcx > ,
7669 tcx : TyCtxt < ' tcx > ,
@@ -257,7 +250,6 @@ impl<'tcx> DumpVisitor<'tcx> {
257250 def_id : LocalDefId ,
258251 ident : Ident ,
259252 generics : & ' tcx hir:: Generics < ' tcx > ,
260- vis : & hir:: Visibility < ' tcx > ,
261253 span : Span ,
262254 ) {
263255 debug ! ( "process_method: {:?}:{}" , def_id, ident) ;
@@ -275,7 +267,7 @@ impl<'tcx> DumpVisitor<'tcx> {
275267 fn_to_string ( sig. decl , sig. header , Some ( ident. name ) , generics, & [ ] , None ) ;
276268 method_data. sig = sig:: method_signature ( hir_id, ident, generics, sig, & v. save_ctxt ) ;
277269
278- v. dumper . dump_def ( & access_from_vis ! ( v. save_ctxt, vis , def_id) , method_data) ;
270+ v. dumper . dump_def ( & access_from ! ( v. save_ctxt, def_id) , method_data) ;
279271 }
280272
281273 // walk arg and return types
@@ -407,7 +399,6 @@ impl<'tcx> DumpVisitor<'tcx> {
407399 typ : & ' tcx hir:: Ty < ' tcx > ,
408400 expr : Option < & ' tcx hir:: Expr < ' tcx > > ,
409401 parent_id : DefId ,
410- vis : & hir:: Visibility < ' tcx > ,
411402 attrs : & ' tcx [ ast:: Attribute ] ,
412403 ) {
413404 let qualname = format ! ( "::{}" , self . tcx. def_path_str( def_id. to_def_id( ) ) ) ;
@@ -418,7 +409,7 @@ impl<'tcx> DumpVisitor<'tcx> {
418409 let span = self . span_from_span ( ident. span ) ;
419410
420411 self . dumper . dump_def (
421- & access_from_vis ! ( self . save_ctxt, vis , def_id) ,
412+ & access_from ! ( self . save_ctxt, def_id) ,
422413 Def {
423414 kind : DefKind :: Const ,
424415 id : id_from_hir_id ( hir_id, & self . save_ctxt ) ,
@@ -983,33 +974,28 @@ impl<'tcx> DumpVisitor<'tcx> {
983974
984975 fn process_trait_item ( & mut self , trait_item : & ' tcx hir:: TraitItem < ' tcx > , trait_id : DefId ) {
985976 self . process_macro_use ( trait_item. span ) ;
986- let vis_span = trait_item. span . shrink_to_lo ( ) ;
987977 match trait_item. kind {
988978 hir:: TraitItemKind :: Const ( ref ty, body) => {
989979 let body = body. map ( |b| & self . tcx . hir ( ) . body ( b) . value ) ;
990- let respan = respan ( vis_span, hir:: VisibilityKind :: Public ) ;
991980 let attrs = self . tcx . hir ( ) . attrs ( trait_item. hir_id ( ) ) ;
992981 self . process_assoc_const (
993982 trait_item. def_id ,
994983 trait_item. ident ,
995984 & ty,
996985 body,
997986 trait_id,
998- & respan,
999987 attrs,
1000988 ) ;
1001989 }
1002990 hir:: TraitItemKind :: Fn ( ref sig, ref trait_fn) => {
1003991 let body =
1004992 if let hir:: TraitFn :: Provided ( body) = trait_fn { Some ( * body) } else { None } ;
1005- let respan = respan ( vis_span, hir:: VisibilityKind :: Public ) ;
1006993 self . process_method (
1007994 sig,
1008995 body,
1009996 trait_item. def_id ,
1010997 trait_item. ident ,
1011998 & trait_item. generics ,
1012- & respan,
1013999 trait_item. span ,
10141000 ) ;
10151001 }
@@ -1068,7 +1054,6 @@ impl<'tcx> DumpVisitor<'tcx> {
10681054 & ty,
10691055 Some ( & body. value ) ,
10701056 impl_id,
1071- & impl_item. vis ,
10721057 attrs,
10731058 ) ;
10741059 }
@@ -1079,7 +1064,6 @@ impl<'tcx> DumpVisitor<'tcx> {
10791064 impl_item. def_id ,
10801065 impl_item. ident ,
10811066 & impl_item. generics ,
1082- & impl_item. vis ,
10831067 impl_item. span ,
10841068 ) ;
10851069 }
0 commit comments