about summary refs log tree commit diff
path: root/tests/rustdoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-29 14:31:21 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-29 18:08:51 +0200
commit9119eba24de69902ba421151691d7a294d96fa04 (patch)
tree3743a585d71f56b9fabfbf0015464a9d80d8f15b /tests/rustdoc
parent06a6dcd4d276826a7600302c08a0d448e23c1d33 (diff)
downloadrust-9119eba24de69902ba421151691d7a294d96fa04.tar.gz
rust-9119eba24de69902ba421151691d7a294d96fa04.zip
Add regression test for doc cfg applied on public items inside private items
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/doc-auto-cfg-public-in-private.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/rustdoc/doc-auto-cfg-public-in-private.rs b/tests/rustdoc/doc-auto-cfg-public-in-private.rs
new file mode 100644
index 00000000000..b78e3f1b932
--- /dev/null
+++ b/tests/rustdoc/doc-auto-cfg-public-in-private.rs
@@ -0,0 +1,16 @@
+// This test ensures that even though private items are removed from generated docs,
+// their `cfg`s will still impact their child items.
+
+#![feature(doc_cfg)]
+#![crate_name = "foo"]
+
+pub struct X;
+
+#[cfg(not(feature = "blob"))]
+fn foo() {
+    impl X {
+        //@ has 'foo/struct.X.html'
+        //@ has - '//*[@class="stab portability"]' 'Available on non-crate feature blob only.'
+        pub fn bar() {}
+    }
+}