diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 15fe840d65f6d..0ff708d01f5e7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2053,7 +2053,8 @@ fn clean_use_statement( // forcefully don't inline if this is not public or if the // #[doc(no_inline)] attribute is present. // Don't inline doc(hidden) imports so they can be stripped at a later stage. - let mut denied = (!import.vis.node.is_pub() && !cx.render_options.document_private) + let mut denied = !(import.vis.node.is_pub() + || (cx.render_options.document_private && import.vis.node.is_pub_restricted())) || pub_underscore || attrs.iter().any(|a| { a.has_name(sym::doc) diff --git a/src/test/rustdoc/reexports-priv.rs b/src/test/rustdoc/reexports-priv.rs index a0a415e29dd41..ff7424033aa49 100644 --- a/src/test/rustdoc/reexports-priv.rs +++ b/src/test/rustdoc/reexports-priv.rs @@ -46,3 +46,8 @@ pub use reexports::Union; pub(crate) use reexports::UnionCrate; // @has 'foo/union.UnionSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionSelf {' pub(self) use reexports::UnionSelf; + +pub mod foo { + // @!has 'foo/foo/union.Union.html' + use crate::reexports::Union; +}