Skip to content

Commit

Permalink
Add regression test for missing item from private mod in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 29, 2022
1 parent f0234f1 commit 0ef36b8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/passes/stripper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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::*;

0 comments on commit 0ef36b8

Please sign in to comment.