Skip to content

Commit 689e360

Browse files
test: rustdoc-ui: Add issue-74134, replacing test/rustdoc/issue-74134-*
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.
1 parent c8b16cd commit 689e360

File tree

6 files changed

+36
-43
lines changed

6 files changed

+36
-43
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: `[PrivateType]` public documentation for `public_item` links to a private item
2+
--> $DIR/issue-74134.rs:19:10
3+
|
4+
LL | /// [`PrivateType`]
5+
| ^^^^^^^^^^^^^ this item is private
6+
|
7+
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
8+
9+
warning: 1 warning emitted
10+

src/test/rustdoc-ui/issue-74134.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// revisions: public private
2+
// [private]compile-flags: --document-private-items
3+
// check-pass
4+
5+
// There are 4 cases here:
6+
// 1. public item -> public type: no warning
7+
// 2. public item -> private type: warning, if --document-private-items is not passed
8+
// 3. private item -> public type: no warning
9+
// 4. private item -> private type: no warning
10+
// All 4 cases are tested with and without --document-private-items.
11+
//
12+
// Case 4 without --document-private-items is the one described in issue #74134.
13+
14+
struct PrivateType;
15+
pub struct PublicType;
16+
17+
pub struct Public {
18+
/// [`PublicType`]
19+
/// [`PrivateType`]
20+
//[public]~^ WARNING `[PrivateType]` public documentation for `public_item` links to a private item
21+
pub public_item: u32,
22+
23+
/// [`PublicType`]
24+
/// [`PrivateType`]
25+
private_item: u32,
26+
}

src/test/rustdoc/issue-74134-1.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/test/rustdoc/issue-74134-2.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/rustdoc/issue-74134-3.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/rustdoc/issue-74134-4.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)