@@ -36,15 +36,15 @@ use rustc::ty::{self, TyCtxt, ImplOrTraitItem, ImplOrTraitItemContainer};
36
36
use std:: collections:: HashSet ;
37
37
use std:: hash:: * ;
38
38
39
- use syntax:: ast:: { self , NodeId , PatKind } ;
39
+ use syntax:: ast:: { self , NodeId , PatKind , Attribute } ;
40
40
use syntax:: parse:: token:: { self , keywords} ;
41
41
use syntax:: visit:: { self , Visitor } ;
42
42
use syntax:: print:: pprust:: { path_to_string, ty_to_string, bounds_to_string, generics_to_string} ;
43
43
use syntax:: ptr:: P ;
44
44
use syntax:: codemap:: Spanned ;
45
45
use syntax_pos:: * ;
46
46
47
- use super :: { escape, generated_code, SaveContext , PathCollector } ;
47
+ use super :: { escape, generated_code, SaveContext , PathCollector , docs_for_attrs } ;
48
48
use super :: data:: * ;
49
49
use super :: dump:: Dump ;
50
50
use super :: external_data:: Lower ;
@@ -368,6 +368,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
368
368
scope : 0 ,
369
369
parent : None ,
370
370
visibility : Visibility :: Inherited ,
371
+ docs : String :: new ( ) ,
371
372
} . lower ( self . tcx ) ) ;
372
373
}
373
374
}
@@ -380,6 +381,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
380
381
id : ast:: NodeId ,
381
382
name : ast:: Name ,
382
383
vis : Visibility ,
384
+ attrs : & [ Attribute ] ,
383
385
span : Span ) {
384
386
debug ! ( "process_method: {}:{}" , id, name) ;
385
387
@@ -421,6 +423,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
421
423
value : sig_str,
422
424
decl_id : decl_id,
423
425
visibility : vis,
426
+ docs : docs_for_attrs ( attrs) ,
424
427
} . lower ( self . tcx ) ) ;
425
428
}
426
429
@@ -491,6 +494,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
491
494
value : String :: new ( ) ,
492
495
visibility : Visibility :: Inherited ,
493
496
parent : None ,
497
+ docs : String :: new ( ) ,
494
498
} . lower ( self . tcx ) ) ;
495
499
}
496
500
}
@@ -541,7 +545,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
541
545
typ : & ast:: Ty ,
542
546
expr : & ast:: Expr ,
543
547
parent_id : NodeId ,
544
- vis : Visibility ) {
548
+ vis : Visibility ,
549
+ attrs : & [ Attribute ] ) {
545
550
let qualname = format ! ( "::{}" , self . tcx. node_path_str( id) ) ;
546
551
547
552
let sub_span = self . span . sub_span_after_keyword ( span, keywords:: Const ) ;
@@ -558,6 +563,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
558
563
scope : self . cur_scope ,
559
564
parent : Some ( parent_id) ,
560
565
visibility : vis,
566
+ docs : docs_for_attrs ( attrs) ,
561
567
} . lower ( self . tcx ) ) ;
562
568
}
563
569
@@ -600,6 +606,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
600
606
value : val,
601
607
fields : fields,
602
608
visibility : From :: from ( & item. vis ) ,
609
+ docs : docs_for_attrs ( & item. attrs ) ,
603
610
} . lower ( self . tcx ) ) ;
604
611
}
605
612
@@ -653,6 +660,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
653
660
value : val,
654
661
scope : enum_data. scope ,
655
662
parent : Some ( item. id ) ,
663
+ docs : docs_for_attrs ( & variant. node . attrs ) ,
656
664
} . lower ( self . tcx ) ) ;
657
665
}
658
666
}
@@ -677,6 +685,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
677
685
value : val,
678
686
scope : enum_data. scope ,
679
687
parent : Some ( item. id ) ,
688
+ docs : docs_for_attrs ( & variant. node . attrs ) ,
680
689
} . lower ( self . tcx ) ) ;
681
690
}
682
691
}
@@ -759,6 +768,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
759
768
value : val,
760
769
items : methods. iter ( ) . map ( |i| i. id ) . collect ( ) ,
761
770
visibility : From :: from ( & item. vis ) ,
771
+ docs : docs_for_attrs ( & item. attrs ) ,
762
772
} . lower ( self . tcx ) ) ;
763
773
}
764
774
@@ -1007,6 +1017,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
1007
1017
scope : 0 ,
1008
1018
parent : None ,
1009
1019
visibility : Visibility :: Inherited ,
1020
+ docs : String :: new ( ) ,
1010
1021
} . lower ( self . tcx ) ) ;
1011
1022
}
1012
1023
}
@@ -1036,7 +1047,9 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
1036
1047
self . dumper . macro_data ( MacroData {
1037
1048
span : sub_span,
1038
1049
name : data. name . clone ( ) ,
1039
- qualname : qualname. clone ( )
1050
+ qualname : qualname. clone ( ) ,
1051
+ // FIXME where do macro docs come from?
1052
+ docs : String :: new ( ) ,
1040
1053
} . lower ( self . tcx ) ) ;
1041
1054
}
1042
1055
}
@@ -1049,7 +1062,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
1049
1062
qualname : qualname,
1050
1063
scope : data. scope ,
1051
1064
callee_span : data. callee_span ,
1052
- imported : data. imported
1065
+ imported : data. imported ,
1053
1066
} . lower ( self . tcx ) ) ;
1054
1067
}
1055
1068
}
@@ -1065,14 +1078,16 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
1065
1078
& ty,
1066
1079
& expr,
1067
1080
trait_id,
1068
- Visibility :: Public ) ;
1081
+ Visibility :: Public ,
1082
+ & trait_item. attrs ) ;
1069
1083
}
1070
1084
ast:: TraitItemKind :: Method ( ref sig, ref body) => {
1071
1085
self . process_method ( sig,
1072
1086
body. as_ref ( ) . map ( |x| & * * x) ,
1073
1087
trait_item. id ,
1074
1088
trait_item. ident . name ,
1075
1089
Visibility :: Public ,
1090
+ & trait_item. attrs ,
1076
1091
trait_item. span ) ;
1077
1092
}
1078
1093
ast:: TraitItemKind :: Const ( _, None ) |
@@ -1091,14 +1106,16 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
1091
1106
& ty,
1092
1107
& expr,
1093
1108
impl_id,
1094
- From :: from ( & impl_item. vis ) ) ;
1109
+ From :: from ( & impl_item. vis ) ,
1110
+ & impl_item. attrs ) ;
1095
1111
}
1096
1112
ast:: ImplItemKind :: Method ( ref sig, ref body) => {
1097
1113
self . process_method ( sig,
1098
1114
Some ( body) ,
1099
1115
impl_item. id ,
1100
1116
impl_item. ident . name ,
1101
1117
From :: from ( & impl_item. vis ) ,
1118
+ & impl_item. attrs ,
1102
1119
impl_item. span ) ;
1103
1120
}
1104
1121
ast:: ImplItemKind :: Type ( _) |
@@ -1240,6 +1257,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
1240
1257
value : value,
1241
1258
visibility : From :: from ( & item. vis ) ,
1242
1259
parent : None ,
1260
+ docs : docs_for_attrs ( & item. attrs ) ,
1243
1261
} . lower ( self . tcx ) ) ;
1244
1262
}
1245
1263
@@ -1429,6 +1447,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
1429
1447
scope : 0 ,
1430
1448
parent : None ,
1431
1449
visibility : Visibility :: Inherited ,
1450
+ docs : String :: new ( ) ,
1432
1451
} . lower ( self . tcx ) ) ;
1433
1452
}
1434
1453
}
0 commit comments