Skip to content

rustdoc: Allow linking from private items to private types - #74147

Merged
bors merged 4 commits into
rust-lang:masterfrom
dennis-hamester:fix/issue-74134
Jul 14, 2020
Merged

rustdoc: Allow linking from private items to private types#74147
bors merged 4 commits into
rust-lang:masterfrom
dennis-hamester:fix/issue-74134

Conversation

@dennis-hamester

Copy link
Copy Markdown
Contributor

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.

Fixesrust-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.
@rust-highfive

Copy link
Copy Markdown
Contributor

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.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 8, 2020
dennis-hamester added a commit to dennis-hamester/aldrin that referenced this pull request Jul 9, 2020
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
@jyn514

Copy link
Copy Markdown
Member

r? @jyn514

@jyn514jyn514 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.

r=me modulo nits

Comment threadsrc/test/rustdoc/issue-74134-2.rs Outdated
Comment threadsrc/test/rustdoc/issue-74134-4.rs Outdated
Comment threadsrc/test/rustdoc/issue-74134-4.rs Outdated
Comment threadsrc/librustdoc/passes/collect_intra_doc_links.rs
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.
@Manishearth

Copy link
Copy Markdown
Member

@bors delegate=jyn514

test seems okay

@bors

bors commented Jul 11, 2020

Copy link
Copy Markdown
Collaborator

✌️ @jyn514 can now approve this pull request

@jyn514

Copy link
Copy Markdown
Member

@bors r=@jyn514

@bors

bors commented Jul 11, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 8789525 has been approved by jyn514

@borsbors 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2020
@Manishearth

Copy link
Copy Markdown
Member

(you can just r+, r=foo is if you need to r+ on behalf of someone)

@jyn514

Copy link
Copy Markdown
Member

@bors rollup=always

@Manishearth

Copy link
Copy Markdown
Member

rollup=always is not really what i'd do here, but it's fine

@jyn514

Copy link
Copy Markdown
Member

@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.

@Manishearth

Copy link
Copy Markdown
Member

(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)

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…jyn514
rustdoc: Allow linking from private items to private types
Fixesrust-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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 14, 2020
…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
@bors
bors merged commit e4a9b36 into rust-lang:masterJul 14, 2020
@dennis-hamester
dennis-hamester deleted the fix/issue-74134 branch July 14, 2020 16:37
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 22, 2020
…-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).
@cuvipercuviper added this to the 1.46 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustdoc links to private types on private items generate a warning

7 participants

@dennis-hamester@rust-highfive@jyn514@Manishearth@bors@cuviper@ollie27