You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we have crates a, and b (crate b being a nested crate within crate a), and we have the following in a/b/src/lib.rs:
#[doc(hidden)]pubstructHiddenInCrateB;
and then in a/src/lib.rs:
/// Docs that I think should be generated for an inlined re-export of `b::DocHiddenInB` but are not#[doc(inline)]pubuse b::HiddenInCrateB;mod c {#[doc(hidden)]pubstructHiddenInModuleC;}/// Docs that are generated for an inlined re-export of `c::HiddenInModuleC`#[doc(inline)]pubuse c::HiddenInModuleC;
and then run cargo doc and open the generated documentation for crate a we would see an entry HiddenInModuleC but not for HiddenInCrateB
I expected documentation to be generated for both HiddenInModuleC and HiddenInCrateB, or alternatively no docs being generated for either.
GuillaumeGomez
added
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Apr 4, 2024
Rollup merge of rust-lang#123459 - GuillaumeGomez:fix-123435, r=notriddle
Correctly handle inlining of doc hidden foreign items
Fixesrust-lang#123435.
In case a foreign item has doc(hidden) attribute, we simply merged its attributes with the re-export's, making it being removed once in the `strip_hidden` pass.
The solution was to use the same as for local reexported items: merge attributes, but not some of them (like `doc(hidden)`).
I originally checked if we could simply update `Item::is_doc_hidden` method to use `self.inline_stmt_id.is_some_and(|def_id| tcx.is_doc_hidden(def_id))` but unfortunately, it added (local) items that shouldn't be inlined. At least it unifies local and foreign items inlining, which I think is the best course of action here.
r? `@notriddle`
Suppose we have crates a, and b (crate b being a nested crate within crate a), and we have the following in
a/b/src/lib.rs
:and then in
a/src/lib.rs
:and then run
cargo doc
and open the generated documentation for crate a we would see an entryHiddenInModuleC
but not forHiddenInCrateB
I expected documentation to be generated for both
HiddenInModuleC
andHiddenInCrateB
, or alternatively no docs being generated for either.Meta
rustc --version --verbose
:Tasks
The text was updated successfully, but these errors were encountered: