File: issue-74134.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (41 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//@ revisions: public private
//@ [private]compile-flags: --document-private-items
//@ check-pass

// There are 4 cases here:
// 1. public item  -> public type:  no warning
// 2. public item  -> private type: warning
// 3. private item -> public type:  no warning
// 4. private item -> private type: no warning
// All 4 cases are tested with and without --document-private-items.
//
// Case 4 without --document-private-items is the one described in issue #74134.

struct PrivateType;
pub struct PublicType;

pub struct Public {
    /// [`PublicType`]
    /// [`PrivateType`]
    //~^ WARNING public documentation for `public_item` links to private item `PrivateType`
    pub public_item: u32,

    /// [`PublicType`]
    /// [`PrivateType`]
    private_item: u32,
}

// The following cases are identical to the ones above, except that they are in a private
// module. Thus they all fall into cases 3 and 4 and should not produce a warning.

mod private {
    pub struct Public {
        /// [`super::PublicType`]
        /// [`super::PrivateType`]
        pub public_item: u32,

        /// [`super::PublicType`]
        /// [`super::PrivateType`]
        private_item: u32,
    }
}