@@ -31,6 +31,8 @@ pub struct ImportInfo {
31
31
pub container : ModuleId ,
32
32
/// Whether this item is annotated with `#[doc(hidden)]`.
33
33
pub is_doc_hidden : bool ,
34
+ /// Whether this item is annoated with `#[doc(hidden)]`
35
+ pub is_doc_notable_trait : bool ,
34
36
/// Whether this item is annotated with `#[unstable(..)]`.
35
37
pub is_unstable : bool ,
36
38
}
@@ -51,6 +53,7 @@ pub struct ImportMap {
51
53
/// same name right after each other. This allows us to find all items after the FST gives us
52
54
/// the index of the first one.
53
55
importables : Vec < ItemInNs > ,
56
+ notable_traits : Vec < ItemInNs > ,
54
57
fst : fst:: Map < Vec < u8 > > ,
55
58
}
56
59
@@ -78,6 +81,18 @@ impl ImportMap {
78
81
79
82
let map = collect_import_map ( db, krate) ;
80
83
84
+ let notable_traits: Vec < _ > = map
85
+ . iter ( )
86
+ . filter_map ( |( & item, ( info, _) ) | {
87
+ let is_notable_trait = info. iter ( ) . any ( |info| info. is_doc_notable_trait ) ;
88
+ if is_notable_trait {
89
+ Some ( item)
90
+ } else {
91
+ None
92
+ }
93
+ } )
94
+ . collect ( ) ;
95
+
81
96
let mut importables: Vec < _ > = map
82
97
. iter ( )
83
98
// We've only collected items, whose name cannot be tuple field.
@@ -104,6 +119,7 @@ impl ImportMap {
104
119
105
120
Arc :: new ( ImportMap {
106
121
map,
122
+ notable_traits,
107
123
fst : builder. into_map ( ) ,
108
124
importables : importables. into_iter ( ) . map ( |( item, _, _) | item) . collect ( ) ,
109
125
} )
@@ -160,15 +176,17 @@ fn collect_import_map(db: &dyn DefDatabase, krate: CrateId) -> ImportMapIndex {
160
176
ItemInNs :: Macros ( id) => Some ( id. into ( ) ) ,
161
177
}
162
178
} ;
163
- let ( is_doc_hidden, is_unstable) = attr_id. map_or ( ( false , false ) , |attr_id| {
164
- let attrs = db. attrs ( attr_id) ;
165
- ( attrs. has_doc_hidden ( ) , attrs. is_unstable ( ) )
166
- } ) ;
179
+ let ( is_doc_hidden, is_doc_notable_trait, is_unstable) =
180
+ attr_id. map_or ( ( false , false , false ) , |attr_id| {
181
+ let attrs = db. attrs ( attr_id) ;
182
+ ( attrs. has_doc_hidden ( ) , attrs. has_doc_notable_trait ( ) , attrs. is_unstable ( ) )
183
+ } ) ;
167
184
168
185
let import_info = ImportInfo {
169
186
name : name. clone ( ) ,
170
187
container : module,
171
188
is_doc_hidden,
189
+ is_doc_notable_trait,
172
190
is_unstable,
173
191
} ;
174
192
@@ -228,6 +246,7 @@ fn collect_trait_assoc_items(
228
246
container : trait_import_info. container ,
229
247
name : assoc_item_name. clone ( ) ,
230
248
is_doc_hidden : attrs. has_doc_hidden ( ) ,
249
+ is_doc_notable_trait : attrs. has_doc_notable_trait ( ) ,
231
250
is_unstable : attrs. is_unstable ( ) ,
232
251
} ;
233
252
0 commit comments