about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2022-10-29 14:18:04 +0200
committerGitHub <noreply@github.com>2022-10-29 14:18:04 +0200
commit05ab16b54eaa002ed98cd6182c850ad549749bf7 (patch)
tree48aa3783a703d5f0f560b44eb61f5f2e2bfc40c8 /src/test
parent2414a4c31a56a34ac6944e360b230ffe54a3a31b (diff)
parent0ef36b89459956af005b4186e4321f7f0376ec7d (diff)
downloadrust-05ab16b54eaa002ed98cd6182c850ad549749bf7.tar.gz
rust-05ab16b54eaa002ed98cd6182c850ad549749bf7.zip
Rollup merge of #103653 - GuillaumeGomez:missing-impl-private-json, r=notriddle
Add missing impl blocks for item reexported from private mod in JSON output

Fixes #102583.

Since we don't inline for the JSON output, the impl blocks from private modules are not present when we generate the output. To go around this limitation, in case the impl block doesn't have `#[doc(hidden)]` and is implementing a public item, we don't strip it.

cc `@fmease` `@aDotInTheVoid`
r? `@notriddle`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs b/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs
new file mode 100644
index 00000000000..239b1a23b43
--- /dev/null
+++ b/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs
@@ -0,0 +1,28 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/102583>.
+
+// @set impl_S = "$.index[*][?(@.docs=='impl S')].id"
+// @has "$.index[*][?(@.name=='S')].inner.impls[*]" $impl_S
+// @set is_present = "$.index[*][?(@.name=='is_present')].id"
+// @is "$.index[*][?(@.docs=='impl S')].inner.items[*]" $is_present
+// @!has "$.index[*][?(@.name=='hidden_impl')]"
+// @!has "$.index[*][?(@.name=='hidden_fn')]"
+
+#![no_std]
+
+mod private_mod {
+    pub struct S;
+
+    /// impl S
+    impl S {
+        pub fn is_present() {}
+        #[doc(hidden)]
+        pub fn hidden_fn() {}
+    }
+
+    #[doc(hidden)]
+    impl S {
+        pub fn hidden_impl() {}
+    }
+}
+
+pub use private_mod::*;