about summary refs log tree commit diff
path: root/tests/rustdoc-ui/issues/issue-74134.rs
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-04-29 04:08:33 -0500
committerjyn <github@jyn.dev>2023-04-29 11:36:19 -0500
commit5fa975142f98939222e12e8ca1338185cc7feb1c (patch)
treed5f805c3ec219937a0f173ae7f274089af2ac2e0 /tests/rustdoc-ui/issues/issue-74134.rs
parent572c0d553f2bd1b934b08fe240310112369a5c76 (diff)
downloadrust-5fa975142f98939222e12e8ca1338185cc7feb1c.tar.gz
rust-5fa975142f98939222e12e8ca1338185cc7feb1c.zip
Move some rustdoc-ui tests to subdirectories
Diffstat (limited to 'tests/rustdoc-ui/issues/issue-74134.rs')
-rw-r--r--tests/rustdoc-ui/issues/issue-74134.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/issues/issue-74134.rs b/tests/rustdoc-ui/issues/issue-74134.rs
new file mode 100644
index 00000000000..b1be9123aaf
--- /dev/null
+++ b/tests/rustdoc-ui/issues/issue-74134.rs
@@ -0,0 +1,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,
+    }
+}