@@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashSet;
14
14
use rustc_hir as hir;
15
15
use rustc_hir:: intravisit:: { self , Visitor } ;
16
16
use rustc_hir:: { AnonConst , Expr } ;
17
- use rustc_lint:: { LateContext , LateLintPass } ;
17
+ use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
18
18
use rustc_middle:: hir:: nested_filter;
19
19
use rustc_middle:: lint:: in_external_macro;
20
20
use rustc_middle:: ty;
@@ -523,7 +523,11 @@ struct DocHeaders {
523
523
/// Others are checked elsewhere, e.g. in `check_doc` if they need access to markdown, or
524
524
/// back in the various late lint pass methods if they need the final doc headers, like "Safety" or
525
525
/// "Panics" sections.
526
- fn check_attrs ( cx : & LateContext < ' _ > , valid_idents : & FxHashSet < String > , attrs : & [ Attribute ] ) -> Option < DocHeaders > {
526
+ fn check_attrs < ' cx > (
527
+ cx : & LateContext < ' cx > ,
528
+ valid_idents : & FxHashSet < String > ,
529
+ attrs : & ' cx [ Attribute ] ,
530
+ ) -> Option < DocHeaders > {
527
531
/// We don't want the parser to choke on intra doc links. Since we don't
528
532
/// actually care about rendering them, just pretend that all broken links
529
533
/// point to a fake address.
@@ -538,7 +542,16 @@ fn check_attrs(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs: &[
538
542
539
543
suspicious_doc_comments:: check ( cx, attrs) ;
540
544
541
- let ( fragments, _) = attrs_to_doc_fragments ( attrs. iter ( ) . map ( |attr| ( attr, None ) ) , true ) ;
545
+ let ( fragments, _) = attrs_to_doc_fragments (
546
+ attrs. iter ( ) . filter_map ( |attr| {
547
+ if in_external_macro ( cx. sess ( ) , attr. span ) {
548
+ None
549
+ } else {
550
+ Some ( ( attr, None ) )
551
+ }
552
+ } ) ,
553
+ true ,
554
+ ) ;
542
555
let mut doc = fragments. iter ( ) . fold ( String :: new ( ) , |mut acc, fragment| {
543
556
add_doc_fragment ( & mut acc, fragment) ;
544
557
acc
0 commit comments