Skip to content

rustdoc: Correctly handle reexports when --document-private-items is used - #161362

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
GuillaumeGomez:reexports-document-private
Oct 25, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
GuillaumeGomez:reexports-document-private

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

View all comments

Fixes #159109.

This PR makes the (private) reexport work like the public ones when the --document-private-items option is used. I still differentiate between imports (use) and reexports (pub(...) use) in this PR as I don't think we should display imports.

r? @Urgau

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Aug 19, 2026
//@ hasraw - "Mod1Public"
//@ !hasraw - "Mod1Private"
//@ !hasraw - "mod2"
//@ hasraw - "Mod1Private"

@GuillaumeGomez GuillaumeGomez Aug 19, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun fact: this test was added in 2016 in #37773. :)

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the reexports-document-private branch from bdb8873 to 9baaae5 Compare August 19, 2026 16:10
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the reexports-document-private branch from 9baaae5 to 7d595c2 Compare August 19, 2026 16:23
Comment thread src/librustdoc/visit_ast.rs Outdated
@Urgau

Urgau commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

I was wondering if this was a breaking change, but our documentation clearly states:

--document-private-items includes all non-public items in the generated documentation except for #[doc(hidden)] items.

as such, this seems clearly like a bug fix.

@rust-log-analyzer

This comment was marked as resolved.

@Urgau Urgau added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-t-rustdoc Status: Awaiting decision from T-rustdoc and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2026
@GuillaumeGomez
GuillaumeGomez force-pushed the reexports-document-private branch from 7d595c2 to 819238e Compare October 23, 2026 10:42
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

So now, all use in the crate module are visible.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2026
@GuillaumeGomez
GuillaumeGomez force-pushed the reexports-document-private branch from 819238e to 5862ffc Compare October 24, 2026 15:58
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Applied suggestions.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the reexports-document-private branch 2 times, most recently from 8844d76 to 59f6fd9 Compare October 24, 2026 17:51

@Urgau Urgau left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, r=me with the comment fixed

View changes since this review

Comment thread src/librustdoc/visit_ast.rs Outdated
Comment on lines +494 to +496
// we're documenting private item. If we are, then we want all items, except if it's a
// `use`. In this case, we want to check if it's a reexport. To do so, we check if there is
// a `pub(...)` part with its `vis_span` field.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs updating, it still talks about checking vis_span.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah indeed, removing that part.

@Urgau Urgau added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-t-rustdoc Status: Awaiting decision from T-rustdoc labels Oct 24, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 25, 2026
…private, r=Urgau

 rustdoc: Correctly handle reexports when --document-private-items is used

Fixes rust-lang#159109.

This PR makes the (private) reexport work like the public ones when the `--document-private-items` option is used. I still differentiate between imports (`use`) and reexports (`pub(...) use`) in this PR as I don't think we should display imports.

r? @Urgau
@jhpratt

jhpratt commented Oct 25, 2026

Copy link
Copy Markdown
Member

@bors yield to rollup

@rust-bors

rust-bors Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #164882.

rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
Rollup of 11 pull requests

Successful merges:

 - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used)
 - #162808 (Enable `--generate-link-to-definition` rustdoc option on std docs)
 - #164834 (miri subtree update)
 - #164869 (rustc_codegen_gcc subtree update)
 - #157123 (library: optimize truncate method)
 - #159916 (Optimize `str.escape_default().to_string()`)
 - #164508 (ping me for layout invariant changes)
 - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY])
 - #164857 (Do not checkout Cargo for bootstrap tests)
 - #164872 (cg_llvm: clarify Send / Sync story for modules)
 - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`)
@rust-bors

rust-bors Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Testing commit f87a2da with merge d652736...

Workflow: https://github.com/rust-lang/rust/actions/runs/40156114629

rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…Urgau

 rustdoc: Correctly handle reexports when --document-private-items is used



Fixes #159109.

This PR makes the (private) reexport work like the public ones when the `--document-private-items` option is used. I still differentiate between imports (`use`) and reexports (`pub(...) use`) in this PR as I don't think we should display imports.

r? @Urgau
@jieyouxu

Copy link
Copy Markdown
Member

I think this failed in rollup: #164882 (comment)

@bors r-
@bors try jobs=dist-aarch64-msvc

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 25, 2026
@rust-bors

rust-bors Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#164882), which was unapproved.

Auto build was cancelled due to unapproval. Cancelled workflows:

View changes since this unapproval

rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…<try>

 rustdoc: Correctly handle reexports when --document-private-items is used


try-job: dist-aarch64-msvc
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a830b7d (a830b7d8ee6c3924e46b32f80504e09ff5b0bac9)
Base parent: dc44e7f (dc44e7f2c436b6041742e138b9c2176f093196d5)

@jieyouxu

Copy link
Copy Markdown
Member

Huh, nevermind...
@bors r=Urgau

@rust-bors

rust-bors Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f87a2da has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 25, 2026
…private, r=Urgau

 rustdoc: Correctly handle reexports when --document-private-items is used

Fixes rust-lang#159109.

This PR makes the (private) reexport work like the public ones when the `--document-private-items` option is used. I still differentiate between imports (`use`) and reexports (`pub(...) use`) in this PR as I don't think we should display imports.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used)
 - #164764 (Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures)
 - #164869 (rustc_codegen_gcc subtree update)
 - #157123 (library: optimize truncate method)
 - #159916 (Optimize `str.escape_default().to_string()`)
 - #164508 (ping me for layout invariant changes)
 - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY])
 - #164836 (Add regression test for #162109)
 - #164857 (Do not checkout Cargo for bootstrap tests)
 - #164868 (Fix skipping library build with `--keep-stage[-std]`)
 - #164872 (cg_llvm: clarify Send / Sync story for modules)
 - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd)
 - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used)
 - #163769 (reborrow: Fix various ICEs related to auto reborrowing of user-space types)
 - #164764 (Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures)
 - #164860 (std::fs: read interrupted by a signal, read_buf_exact_at reports EOF.)
 - #164869 (rustc_codegen_gcc subtree update)
 - #157123 (library: optimize truncate method)
 - #159916 (Optimize `str.escape_default().to_string()`)
 - #163510 (process: Improve the output of `Debug` for `ExitStatus` on Unix)
 - #164508 (ping me for layout invariant changes)
 - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY])
 - #164816 (Take the colon span into account for struct field initializers)
 - #164836 (Add regression test for #162109)
 - #164846 (Remove contradictory inequalities from overflow safety docs)
 - #164857 (Do not checkout Cargo for bootstrap tests)
 - #164868 (Fix skipping library build with `--keep-stage[-std]`)
 - #164872 (cg_llvm: clarify Send / Sync story for modules)
 - #164880 (Add context span showing item that can't be annotated)
 - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`)
 - #164884 (Windows: bounds-check the reparse point name in `read_link`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd)
 - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used)
 - #163769 (reborrow: Fix various ICEs related to auto reborrowing of user-space types)
 - #164764 (Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures)
 - #164860 (std::fs: read interrupted by a signal, read_buf_exact_at reports EOF.)
 - #164869 (rustc_codegen_gcc subtree update)
 - #157123 (library: optimize truncate method)
 - #159916 (Optimize `str.escape_default().to_string()`)
 - #163510 (process: Improve the output of `Debug` for `ExitStatus` on Unix)
 - #164508 (ping me for layout invariant changes)
 - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY])
 - #164816 (Take the colon span into account for struct field initializers)
 - #164836 (Add regression test for #162109)
 - #164846 (Remove contradictory inequalities from overflow safety docs)
 - #164857 (Do not checkout Cargo for bootstrap tests)
 - #164868 (Fix skipping library build with `--keep-stage[-std]`)
 - #164872 (cg_llvm: clarify Send / Sync story for modules)
 - #164880 (Add context span showing item that can't be annotated)
 - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`)
 - #164884 (Windows: bounds-check the reparse point name in `read_link`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
Rollup merge of #161362 - GuillaumeGomez:reexports-document-private, r=Urgau

 rustdoc: Correctly handle reexports when --document-private-items is used

Fixes #159109.

This PR makes the (private) reexport work like the public ones when the `--document-private-items` option is used. I still differentiate between imports (`use`) and reexports (`pub(...) use`) in this PR as I don't think we should display imports.

r? @Urgau
@rust-bors
rust-bors Bot merged commit 86e7417 into rust-lang:main Oct 25, 2026
15 of 16 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 25, 2026
@GuillaumeGomez
GuillaumeGomez deleted the reexports-document-private branch October 25, 2026 21:11
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (2c386ff): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.9% [0.1%, 7.9%] 19
Regressions ❌
(secondary)
27.3% [0.1%, 189.6%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.1%, 7.9%] 19

Max RSS (memory usage)

Results (primary 0.7%, secondary 29.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.3% [0.5%, 4.8%] 9
Regressions ❌
(secondary)
29.6% [20.3%, 38.9%] 2
Improvements ✅
(primary)
-1.1% [-1.5%, -0.5%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-1.5%, 4.8%] 12

Cycles

Results (primary 0.9%, secondary 63.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.2% [0.4%, 4.9%] 11
Regressions ❌
(secondary)
63.7% [2.3%, 161.8%] 3
Improvements ✅
(primary)
-0.7% [-0.8%, -0.6%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-0.8%, 4.9%] 13

Binary size

This perf run didn't have relevant results for this metric.

Artifact size: 405.87 MiB -> 405.94 MiB (0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--document-private-items does not document private reexports

7 participants