@@ -977,6 +977,14 @@ fn should_encode_generics(def_kind: DefKind) -> bool {
977977}
978978
979979impl < ' a , ' tcx > EncodeContext < ' a , ' tcx > {
980+ fn encode_attrs ( & mut self , def_id : DefId ) {
981+ let attrs = self . tcx . get_attrs ( def_id) ;
982+ record ! ( self . tables. attributes[ def_id] <- attrs) ;
983+ if attrs. iter ( ) . any ( |attr| attr. may_have_doc_links ( ) ) {
984+ self . tables . may_have_doc_links . set ( def_id. index , ( ) ) ;
985+ }
986+ }
987+
980988 fn encode_def_ids ( & mut self ) {
981989 if self . is_proc_macro {
982990 return ;
@@ -989,7 +997,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
989997 let Some ( def_kind) = def_kind else { continue } ;
990998 self . tables . opt_def_kind . set ( def_id. index , def_kind) ;
991999 record ! ( self . tables. def_span[ def_id] <- tcx. def_span( def_id) ) ;
992- record ! ( self . tables . attributes [ def_id ] <- tcx . get_attrs ( def_id) ) ;
1000+ self . encode_attrs ( def_id) ;
9931001 record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expn_that_defined( def_id) ) ;
9941002 if should_encode_visibility ( def_kind) {
9951003 record ! ( self . tables. visibility[ def_id] <- self . tcx. visibility( def_id) ) ;
@@ -1651,7 +1659,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16511659
16521660 self . tables . opt_def_kind . set ( LOCAL_CRATE . as_def_id ( ) . index , DefKind :: Mod ) ;
16531661 record ! ( self . tables. def_span[ LOCAL_CRATE . as_def_id( ) ] <- tcx. def_span( LOCAL_CRATE . as_def_id( ) ) ) ;
1654- record ! ( self . tables . attributes [ LOCAL_CRATE . as_def_id ( ) ] <- tcx . get_attrs ( LOCAL_CRATE . as_def_id( ) ) ) ;
1662+ self . encode_attrs ( LOCAL_CRATE . as_def_id ( ) ) ;
16551663 record ! ( self . tables. visibility[ LOCAL_CRATE . as_def_id( ) ] <- tcx. visibility( LOCAL_CRATE . as_def_id( ) ) ) ;
16561664 if let Some ( stability) = stability {
16571665 record ! ( self . tables. lookup_stability[ LOCAL_CRATE . as_def_id( ) ] <- stability) ;
@@ -1692,7 +1700,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16921700 let def_id = id. to_def_id ( ) ;
16931701 self . tables . opt_def_kind . set ( def_id. index , DefKind :: Macro ( macro_kind) ) ;
16941702 record ! ( self . tables. kind[ def_id] <- EntryKind :: ProcMacro ( macro_kind) ) ;
1695- record ! ( self . tables . attributes [ def_id] <- attrs ) ;
1703+ self . encode_attrs ( def_id) ;
16961704 record ! ( self . tables. def_keys[ def_id] <- def_key) ;
16971705 record ! ( self . tables. def_ident_span[ def_id] <- span) ;
16981706 record ! ( self . tables. def_span[ def_id] <- span) ;
0 commit comments