Skip to content

Commit 0ef36b8

Browse files
Add regression test for missing item from private mod in JSON output
1 parent f0234f1 commit 0ef36b8

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/librustdoc/passes/stripper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'a> ImplStripper<'a> {
161161
} else if self.is_json_output {
162162
// If the "for" item is exported and the impl block isn't `#[doc(hidden)]`, then we
163163
// need to keep it.
164-
self.cache.access_levels.is_exported(for_def_id)
164+
self.cache.effective_visibilities.is_exported(for_def_id)
165165
&& !item.attrs.lists(sym::doc).has_word(sym::hidden)
166166
} else {
167167
false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Regression test for <https://github.com/rust-lang/rust/issues/102583>.
2+
3+
// @set impl_S = "$.index[*][?(@.docs=='impl S')].id"
4+
// @has "$.index[*][?(@.name=='S')].inner.impls[*]" $impl_S
5+
// @set is_present = "$.index[*][?(@.name=='is_present')].id"
6+
// @is "$.index[*][?(@.docs=='impl S')].inner.items[*]" $is_present
7+
// @!has "$.index[*][?(@.name=='hidden_impl')]"
8+
// @!has "$.index[*][?(@.name=='hidden_fn')]"
9+
10+
#![no_std]
11+
12+
mod private_mod {
13+
pub struct S;
14+
15+
/// impl S
16+
impl S {
17+
pub fn is_present() {}
18+
#[doc(hidden)]
19+
pub fn hidden_fn() {}
20+
}
21+
22+
#[doc(hidden)]
23+
impl S {
24+
pub fn hidden_impl() {}
25+
}
26+
}
27+
28+
pub use private_mod::*;

0 commit comments

Comments
 (0)