summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc/hidden-private.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /tests/rustdoc/hidden-private.rs
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc/hidden-private.rs')
-rw-r--r--tests/rustdoc/hidden-private.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/rustdoc/hidden-private.rs b/tests/rustdoc/hidden-private.rs
new file mode 100644
index 000000000..834ba5231
--- /dev/null
+++ b/tests/rustdoc/hidden-private.rs
@@ -0,0 +1,50 @@
+// This is a regression test for <https://github.com/rust-lang/rust/issues/106373>.
+// It ensures that the items in the `doc(hidden)` const block don't show up in the
+// generated docs.
+
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// @count - '//*[@class="item-table"]//a[@class="struct"]' 2
+// @count - '//*[@class="item-table"]//a[@class="trait"]' 1
+// @count - '//*[@class="item-table"]//a[@class="macro"]' 0
+#[doc(hidden)]
+const _: () = {
+ macro_rules! stry {
+ () => {};
+ }
+
+ struct ShouldBeHidden;
+
+ // @has 'foo/struct.Foo.html'
+ // @!has - '//*[@class="code-header"]' 'impl Bar for Foo'
+ #[doc(hidden)]
+ impl Bar for Foo {
+ fn bar(&self) {
+ struct SHouldAlsoBeHidden;
+ }
+ }
+
+ // @has 'foo/struct.Private.html'
+ // @has - '//*[@id="impl-Bar-for-Private"]/*[@class="code-header"]' 'impl Bar for Private'
+ // @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar(&self)'
+ impl Bar for Private {
+ fn bar(&self) {}
+ }
+
+ // @has - '//*[@id="impl-Private"]/*[@class="code-header"]' 'impl Private'
+ // @has - '//*[@id="method.tralala"]/*[@class="code-header"]' 'fn tralala()'
+ impl Private {
+ fn tralala() {}
+ }
+};
+
+
+struct Private;
+pub struct Foo;
+
+pub trait Bar {
+ fn bar(&self);
+}