File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ use clippy_utils:: attrs:: is_doc_hidden;
12use clippy_utils:: diagnostics:: { span_lint, span_lint_and_help, span_lint_and_note} ;
23use clippy_utils:: source:: first_line_of_span;
34use clippy_utils:: ty:: { implements_trait, is_type_diagnostic_item} ;
@@ -297,6 +298,17 @@ fn lint_for_missing_headers<'tcx>(
297298 if !cx. access_levels . is_exported ( def_id) {
298299 return ; // Private functions do not require doc comments
299300 }
301+
302+ // do not lint if any parent has `#[doc(hidden)]` attribute (#7347)
303+ if cx
304+ . tcx
305+ . hir ( )
306+ . parent_iter ( cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) )
307+ . any ( |( id, _node) | is_doc_hidden ( cx. tcx . hir ( ) . attrs ( id) ) )
308+ {
309+ return ;
310+ }
311+
300312 if !headers. safety && sig. header . unsafety == hir:: Unsafety :: Unsafe {
301313 span_lint (
302314 cx,
Original file line number Diff line number Diff line change @@ -115,3 +115,13 @@ fn main() {
115115 drive ( ) ;
116116 }
117117}
118+
119+ // do not lint if any parent has `#[doc(hidden)]` attribute
120+ // see #7347
121+ #[ doc( hidden) ]
122+ pub mod __macro {
123+ pub struct T ;
124+ impl T {
125+ pub unsafe fn f ( ) { }
126+ }
127+ }
You can’t perform that action at this time.
0 commit comments