-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustdoc: Allow linking from private items to private types #74147
Conversation
Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ollie27 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This works around issue #74134 in rustdoc and should be reverted when PR #74147 is merged and available in a nightly. - #74134: rust-lang/rust#74134 - #74147: rust-lang/rust#74147
r? @jyn514 |
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.
r=me modulo nits
As per the discussion in PR rust-lang#74147, the 4 individual tests are replaced by a single one. The test is expanded to cover all 4 public/private cases, each with and without --document-private-items.
@bors delegate=jyn514 test seems okay |
✌️ @jyn514 can now approve this pull request |
📌 Commit 8789525 has been approved by |
(you can just r+, r=foo is if you need to r+ on behalf of someone) |
@bors rollup=always |
rollup=always is not really what i'd do here, but it's fine |
@bors rollup=maybe Since this has been waiting for a while, let's give it a chance to make it to the top of the queue. |
(it doesn't matter, it's been waiting for a while because the queue isn't doing great. PRs that are not rollup-never or rollup-iffy are unlikely to be built on their own) |
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…jyn514 rustdoc: Allow linking from private items to private types Fixes rust-lang#74134 After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning when rustdoc is invoked without --document-private-items. Links from private items to private types are however never actually generated in that case and thus shouldn't produce a warning. These links are in fact a very useful tool to document crate internals. Tests are added for all 4 combinations of public/private items and link targets. Test 1 is the case mentioned above and fails without this commit. Tests 2 - 4 passed before already but are added nonetheless to prevent regressions.
…arth Rollup of 8 pull requests Successful merges: - rust-lang#73354 (Update RELEASES.md for 1.45.0) - rust-lang#73852 (rustdoc: insert newlines between attributes) - rust-lang#73867 (Document the union keyword) - rust-lang#74046 (Fix caching issue when building tools.) - rust-lang#74123 (clean up E0718 explanation) - rust-lang#74147 (rustdoc: Allow linking from private items to private types) - rust-lang#74285 (rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics) - rust-lang#74286 (Added detailed error code explanation for issue E0688 in Rust compiler.) Failed merges: r? @ghost
…-priv, r=jyn514 rustdoc: Always warn when linking from public to private items Change the logic such that linking from a public to a private item always triggers `intra_doc_link_resolution_failure`. Previously, the warning was not emitted when `--document-private-items` is passed. This came up during the discussion in rust-lang#74147 (comment).
Fixes #74134
After PR #72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.
Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.