Fix bug where private item with intermediate doc hidden re-export was not inlined
This commit is contained in:
parent
fabf929863
commit
96892a52ed
2 changed files with 4 additions and 2 deletions
|
|
@ -2180,7 +2180,8 @@ fn get_all_import_attributes<'hir>(
|
|||
// This is the "original" reexport so we get all its attributes without filtering them.
|
||||
attrs = import_attrs.iter().map(|attr| (Cow::Borrowed(attr), Some(def_id))).collect();
|
||||
first = false;
|
||||
} else {
|
||||
// We don't add attributes of an intermediate re-export if it has `#[doc(hidden)]`.
|
||||
} else if !cx.tcx.is_doc_hidden(def_id) {
|
||||
add_without_unwanted_attributes(&mut attrs, import_attrs, is_inline, Some(def_id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||
glob: bool,
|
||||
please_inline: bool,
|
||||
) -> bool {
|
||||
debug!("maybe_inline_local res: {:?}", res);
|
||||
debug!("maybe_inline_local (renamed: {renamed:?}) res: {res:?}");
|
||||
|
||||
if renamed == Some(kw::Underscore) {
|
||||
// We never inline `_` reexports.
|
||||
|
|
@ -308,6 +308,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||
.cache
|
||||
.effective_visibilities
|
||||
.is_directly_public(tcx, item_def_id.to_def_id()) &&
|
||||
!tcx.is_doc_hidden(item_def_id) &&
|
||||
!inherits_doc_hidden(tcx, item_def_id, None)
|
||||
{
|
||||
// The imported item is public and not `doc(hidden)` so no need to inline it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue