Skip to content
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

Merged
merged 4 commits into from
Jul 14, 2020

Conversation

dennis-hamester
Copy link
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.

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.
@rust-highfive
Copy link
Collaborator

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-highfive rust-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
Member

jyn514 commented Jul 10, 2020

r? @jyn514

Copy link
Member

@jyn514 jyn514 left a 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

src/test/rustdoc/issue-74134-2.rs Outdated Show resolved Hide resolved
src/test/rustdoc/issue-74134-4.rs Outdated Show resolved Hide resolved
src/test/rustdoc/issue-74134-4.rs Outdated Show resolved Hide resolved
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
Member

@bors delegate=jyn514

test seems okay

@bors
Copy link
Contributor

bors commented Jul 11, 2020

✌️ @jyn514 can now approve this pull request

@jyn514
Copy link
Member

jyn514 commented Jul 11, 2020

@bors r=@jyn514

@bors
Copy link
Contributor

bors commented Jul 11, 2020

📌 Commit 8789525 has been approved by jyn514

@bors bors 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
Member

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

@jyn514
Copy link
Member

jyn514 commented Jul 11, 2020

@bors rollup=always

@Manishearth
Copy link
Member

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

@jyn514
Copy link
Member

jyn514 commented Jul 13, 2020

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

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

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

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

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

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

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.
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:master Jul 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).
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: 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