@@ -977,6 +977,14 @@ fn should_encode_generics(def_kind: DefKind) -> bool {
977
977
}
978
978
979
979
impl < ' 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
+
980
988
fn encode_def_ids ( & mut self ) {
981
989
if self . is_proc_macro {
982
990
return ;
@@ -989,7 +997,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
989
997
let Some ( def_kind) = def_kind else { continue } ;
990
998
self . tables . opt_def_kind . set ( def_id. index , def_kind) ;
991
999
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) ;
993
1001
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expn_that_defined( def_id) ) ;
994
1002
if should_encode_visibility ( def_kind) {
995
1003
record ! ( self . tables. visibility[ def_id] <- self . tcx. visibility( def_id) ) ;
@@ -1651,7 +1659,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1651
1659
1652
1660
self . tables . opt_def_kind . set ( LOCAL_CRATE . as_def_id ( ) . index , DefKind :: Mod ) ;
1653
1661
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 ( ) ) ;
1655
1663
record ! ( self . tables. visibility[ LOCAL_CRATE . as_def_id( ) ] <- tcx. visibility( LOCAL_CRATE . as_def_id( ) ) ) ;
1656
1664
if let Some ( stability) = stability {
1657
1665
record ! ( self . tables. lookup_stability[ LOCAL_CRATE . as_def_id( ) ] <- stability) ;
@@ -1692,7 +1700,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1692
1700
let def_id = id. to_def_id ( ) ;
1693
1701
self . tables . opt_def_kind . set ( def_id. index , DefKind :: Macro ( macro_kind) ) ;
1694
1702
record ! ( self . tables. kind[ def_id] <- EntryKind :: ProcMacro ( macro_kind) ) ;
1695
- record ! ( self . tables . attributes [ def_id] <- attrs ) ;
1703
+ self . encode_attrs ( def_id) ;
1696
1704
record ! ( self . tables. def_keys[ def_id] <- def_key) ;
1697
1705
record ! ( self . tables. def_ident_span[ def_id] <- span) ;
1698
1706
record ! ( self . tables. def_span[ def_id] <- span) ;
0 commit comments