Skip to content

Commit dbb0fe9

Browse files
committed
Auto merge of #88456 - inquisitivecrystal:private-macro, r=jyn514
Fix: don't document private macros by default As part of #88019, I made it so private macros are documented in `--document-private-items` mode. Unfortunately, it appears that I also accidentally made them be documented when *not* in `--document-private-items` mode. This PR fixes that and adds a regression test. r? `@jyn514` (I hope you don't mind that I keep sending PRs your way) Fixes #88453.
2 parents 9556d7a + 6aacbd8 commit dbb0fe9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/librustdoc/passes/stripper.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl<'a> DocFolder for Stripper<'a> {
4040
| clean::UnionItem(..)
4141
| clean::AssocConstItem(..)
4242
| clean::TraitAliasItem(..)
43+
| clean::MacroItem(..)
4344
| clean::ForeignTypeItem => {
4445
if i.def_id.is_local() {
4546
if !self.access_levels.is_exported(i.def_id.expect_def_id()) {
@@ -70,8 +71,8 @@ impl<'a> DocFolder for Stripper<'a> {
7071

7172
clean::ImplItem(..) => {}
7273

73-
// tymethods/macros have no control over privacy
74-
clean::MacroItem(..) | clean::TyMethodItem(..) => {}
74+
// tymethods have no control over privacy
75+
clean::TyMethodItem(..) => {}
7576

7677
// Proc-macros are always public
7778
clean::ProcMacroItem(..) => {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Checks that private macros aren't documented by default. They
2+
// should be still be documented in `--document-private-items` mode,
3+
// but that's tested in `macro-document-private.rs`.
4+
//
5+
//
6+
// This is a regression text for issue #88453.
7+
#![feature(decl_macro)]
8+
9+
// @!has macro_private_not_documented/index.html 'a_macro'
10+
// @!has macro_private_not_documented/macro.a_macro.html
11+
macro_rules! a_macro {
12+
() => ()
13+
}
14+
15+
// @!has macro_private_not_documented/index.html 'another_macro'
16+
// @!has macro_private_not_documented/macro.another_macro.html
17+
macro another_macro {
18+
() => ()
19+
}

0 commit comments

Comments
 (0)