Skip to content

Commit 96892a5

Browse files
Fix bug where private item with intermediate doc hidden re-export was not inlined
1 parent fabf929 commit 96892a5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustdoc/clean/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,8 @@ fn get_all_import_attributes<'hir>(
21802180
// This is the "original" reexport so we get all its attributes without filtering them.
21812181
attrs = import_attrs.iter().map(|attr| (Cow::Borrowed(attr), Some(def_id))).collect();
21822182
first = false;
2183-
} else {
2183+
// We don't add attributes of an intermediate re-export if it has `#[doc(hidden)]`.
2184+
} else if !cx.tcx.is_doc_hidden(def_id) {
21842185
add_without_unwanted_attributes(&mut attrs, import_attrs, is_inline, Some(def_id));
21852186
}
21862187
}

src/librustdoc/visit_ast.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
246246
glob: bool,
247247
please_inline: bool,
248248
) -> bool {
249-
debug!("maybe_inline_local res: {:?}", res);
249+
debug!("maybe_inline_local (renamed: {renamed:?}) res: {res:?}");
250250

251251
if renamed == Some(kw::Underscore) {
252252
// We never inline `_` reexports.
@@ -308,6 +308,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
308308
.cache
309309
.effective_visibilities
310310
.is_directly_public(tcx, item_def_id.to_def_id()) &&
311+
!tcx.is_doc_hidden(item_def_id) &&
311312
!inherits_doc_hidden(tcx, item_def_id, None)
312313
{
313314
// The imported item is public and not `doc(hidden)` so no need to inline it.

0 commit comments

Comments
 (0)