]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-ui/issue-74134.rs
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
[rust.git] / tests / rustdoc-ui / issue-74134.rs
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
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     //~^ WARNING public documentation for `public_item` links to private item `PrivateType`
21     pub public_item: u32,
22
23     /// [`PublicType`]
24     /// [`PrivateType`]
25     private_item: u32,
26 }
27
28 // The following cases are identical to the ones above, except that they are in a private
29 // module. Thus they all fall into cases 3 and 4 and should not produce a warning.
30
31 mod private {
32     pub struct Public {
33         /// [`super::PublicType`]
34         /// [`super::PrivateType`]
35         pub public_item: u32,
36
37         /// [`super::PublicType`]
38         /// [`super::PrivateType`]
39         private_item: u32,
40     }
41 }