@@ -7,6 +7,7 @@ use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
77use rustc_middle:: middle:: privacy:: AccessLevels ;
88use rustc_middle:: ty:: TyCtxt ;
99use rustc_span:: source_map:: FileName ;
10+ use rustc_span:: symbol:: sym;
1011use rustc_span:: Symbol ;
1112
1213use crate :: clean:: { self , GetDefId } ;
@@ -64,7 +65,9 @@ crate struct Cache {
6465 /// Implementations of a crate should inherit the documentation of the
6566 /// parent trait if no extra documentation is specified, and default methods
6667 /// 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 ) > ,
6871
6972 /// When rendering traits, it's often useful to be able to list all
7073 /// implementors of the trait, and this mapping is exactly, that: a mapping
@@ -244,10 +247,13 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
244247 }
245248 }
246249
250+ let tcx = self . tcx ;
247251 // Propagate a trait method's documentation to all implementors of the
248252 // trait.
249253 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+ } ) ;
251257 }
252258
253259 // Collect all the implementors of traits.
0 commit comments