Add regression test for missing item from private mod in JSON output

This commit is contained in:
Guillaume Gomez 2022-10-27 21:48:54 +02:00
parent f0234f1976
commit 0ef36b8945
2 changed files with 29 additions and 1 deletions

View File

@ -161,7 +161,7 @@ impl<'a> ImplStripper<'a> {
} else if self.is_json_output {
// If the "for" item is exported and the impl block isn't `#[doc(hidden)]`, then we
// need to keep it.
self.cache.access_levels.is_exported(for_def_id)
self.cache.effective_visibilities.is_exported(for_def_id)
&& !item.attrs.lists(sym::doc).has_word(sym::hidden)
} else {
false

View File

@ -0,0 +1,28 @@
// Regression test for <https://github.com/rust-lang/rust/issues/102583>.
// @set impl_S = "$.index[*][?(@.docs=='impl S')].id"
// @has "$.index[*][?(@.name=='S')].inner.impls[*]" $impl_S
// @set is_present = "$.index[*][?(@.name=='is_present')].id"
// @is "$.index[*][?(@.docs=='impl S')].inner.items[*]" $is_present
// @!has "$.index[*][?(@.name=='hidden_impl')]"
// @!has "$.index[*][?(@.name=='hidden_fn')]"
#![no_std]
mod private_mod {
pub struct S;
/// impl S
impl S {
pub fn is_present() {}
#[doc(hidden)]
pub fn hidden_fn() {}
}
#[doc(hidden)]
impl S {
pub fn hidden_impl() {}
}
}
pub use private_mod::*;