@@ -7,6 +7,7 @@ use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
7
7
use rustc_middle:: middle:: privacy:: AccessLevels ;
8
8
use rustc_middle:: ty:: TyCtxt ;
9
9
use rustc_span:: source_map:: FileName ;
10
+ use rustc_span:: symbol:: sym;
10
11
use rustc_span:: Symbol ;
11
12
12
13
use crate :: clean:: { self , GetDefId } ;
@@ -64,7 +65,9 @@ crate struct Cache {
64
65
/// Implementations of a crate should inherit the documentation of the
65
66
/// parent trait if no extra documentation is specified, and default methods
66
67
/// should show up in documentation about trait implementations.
67
- crate traits : FxHashMap < DefId , clean:: Trait > ,
68
+ ///
69
+ /// The `bool` parameter is about if the trait is `spotlight`.
70
+ crate traits : FxHashMap < DefId , ( clean:: Trait , bool ) > ,
68
71
69
72
/// When rendering traits, it's often useful to be able to list all
70
73
/// implementors of the trait, and this mapping is exactly, that: a mapping
@@ -244,10 +247,13 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
244
247
}
245
248
}
246
249
250
+ let tcx = self . tcx ;
247
251
// Propagate a trait method's documentation to all implementors of the
248
252
// trait.
249
253
if let clean:: TraitItem ( ref t) = * item. kind {
250
- self . cache . traits . entry ( item. def_id ) . or_insert_with ( || t. clone ( ) ) ;
254
+ self . cache . traits . entry ( item. def_id ) . or_insert_with ( || {
255
+ ( t. clone ( ) , clean:: utils:: has_doc_flag ( tcx. get_attrs ( item. def_id ) , sym:: spotlight) )
256
+ } ) ;
251
257
}
252
258
253
259
// Collect all the implementors of traits.
0 commit comments