-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix re-export of doc hidden item inside private item not displayed #112108
Fix re-export of doc hidden item inside private item not displayed #112108
Conversation
src/librustdoc/visit_ast.rs
Outdated
let Some(item_def_id) = reexport_chain(tcx, def_id, res_did).iter() | ||
let is_hidden = tcx.is_doc_hidden(ori_res_did); | ||
let item = tcx.hir().get_by_def_id(res_did); | ||
let is_module = matches!(item, Node::Item(&hir::Item { kind: hir::ItemKind::Mod(_), .. })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it matter if it's a module or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it's a module, it can contain items that could be re-exported and we need to to go through them too. A good example of this can be seen in tests/rustdoc/infinite-redirection.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment explaining it and moved this matches!()
directly into the if
condition.
cd4dd39
to
9906504
Compare
@bors r+ |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#112031 (Migrate `item_proc_macro` to Askama) - rust-lang#112053 (Remove `-Zcgu-partitioning-strategy`.) - rust-lang#112069 (offset_of: don't require type to be `Sized`) - rust-lang#112084 (enhancements on build_helper utilization and rustdoc-gui-test) - rust-lang#112096 (Remove array_zip) - rust-lang#112108 (Fix re-export of doc hidden item inside private item not displayed) - rust-lang#112113 (rustdoc: simplify `clean` by removing `FnRetTy`) r? `@ghost` `@rustbot` modify labels: rollup
…ddle Add chapter in rustdoc book for re-exports and add a regression test for `#[doc(hidden)]` behaviour Fixes rust-lang#109449. Fixes rust-lang#53417. After the discussion in rust-lang#109697, I made a few PRs to fix a few corner cases: * rust-lang#112178 * rust-lang#112108 * rust-lang#111997 With this I think I covered all cases. Only thing missing at this point was a chapter covering re-exports in the rustdoc book. r? `@notriddle`
This PR fixes this bug:
pub use crate::private_module::Public as Foo;
should be visible in the generated doc (and not inlined!) but currently isn't. This PR fixes it.r? @notriddle