-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #74460 - dennis-hamester:rustdoc-warn-pub-to-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 #74147 (comment).
- Loading branch information
Showing
7 changed files
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
warning: public documentation for `DocMe` links to private item `DontDocMe` | ||
--> $DIR/intra-links-private.rs:5:11 | ||
| | ||
LL | /// docs [DontDocMe] | ||
| ^^^^^^^^^ this item is private | ||
| | ||
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default | ||
= note: this link resolves only because you passed `--document-private-items`, but will break without | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
warning: public documentation for `DocMe` links to private item `DontDocMe` | ||
--> $DIR/intra-links-private.rs:6:11 | ||
--> $DIR/intra-links-private.rs:5:11 | ||
| | ||
LL | /// docs [DontDocMe] | ||
| ^^^^^^^^^ this item is private | ||
| | ||
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default | ||
= note: this link will resolve properly if you pass `--document-private-items` | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
// check-pass | ||
// revisions: public private | ||
// [private]compile-flags: --document-private-items | ||
#![cfg_attr(private, deny(intra_doc_link_resolution_failure))] | ||
|
||
/// docs [DontDocMe] | ||
//[public]~^ WARNING public documentation for `DocMe` links to private item `DontDocMe` | ||
//~^ WARNING public documentation for `DocMe` links to private item `DontDocMe` | ||
// FIXME: for [private] we should also make sure the link was actually generated | ||
pub struct DocMe; | ||
struct DontDocMe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
warning: public documentation for `public_item` links to private item `PrivateType` | ||
--> $DIR/issue-74134.rs:19:10 | ||
| | ||
LL | /// [`PrivateType`] | ||
| ^^^^^^^^^^^^^ this item is private | ||
| | ||
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default | ||
= note: this link resolves only because you passed `--document-private-items`, but will break without | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters