summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc/display-hidden-items.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/rustdoc/display-hidden-items.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc/display-hidden-items.rs')
-rw-r--r--tests/rustdoc/display-hidden-items.rs71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/rustdoc/display-hidden-items.rs b/tests/rustdoc/display-hidden-items.rs
new file mode 100644
index 000000000..d97d5b4a9
--- /dev/null
+++ b/tests/rustdoc/display-hidden-items.rs
@@ -0,0 +1,71 @@
+// Test to ensure that the `--document-hidden-items` option is working as expected.
+// compile-flags: -Z unstable-options --document-hidden-items
+// ignore-tidy-linelength
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// @has - '//*[@id="reexport.hidden_reexport"]/code' 'pub use hidden::inside_hidden as hidden_reexport;'
+#[doc(hidden)]
+pub use hidden::inside_hidden as hidden_reexport;
+
+// @has - '//*[@class="item-name"]/a[@class="trait"]' 'TraitHidden'
+// @has 'foo/trait.TraitHidden.html'
+#[doc(hidden)]
+pub trait TraitHidden {}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="trait"]' 'Trait'
+pub trait Trait {
+ // @has 'foo/trait.Trait.html'
+ // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32'
+ #[doc(hidden)]
+ const BAR: u32 = 0;
+
+ // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()'
+ #[doc(hidden)]
+ fn foo() {}
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="struct"]' 'Struct'
+// @has 'foo/struct.Struct.html'
+pub struct Struct {
+ // @has - '//*[@id="structfield.a"]/code' 'a: u32'
+ #[doc(hidden)]
+ pub a: u32,
+}
+
+impl Struct {
+ // @has - '//*[@id="method.new"]/*[@class="code-header"]' 'pub fn new() -> Self'
+ #[doc(hidden)]
+ pub fn new() -> Self { Self { a: 0 } }
+}
+
+impl Trait for Struct {
+ // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32'
+ // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()'
+}
+// @has - '//*[@id="impl-TraitHidden-for-Struct"]/*[@class="code-header"]' 'impl TraitHidden for Struct'
+impl TraitHidden for Struct {}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'HiddenEnum'
+// @has 'foo/enum.HiddenEnum.html'
+#[doc(hidden)]
+pub enum HiddenEnum {
+ A,
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'Enum'
+pub enum Enum {
+ // @has 'foo/enum.Enum.html' '//*[@id="variant.A"]/*[@class="code-header"]' 'A'
+ #[doc(hidden)]
+ A,
+}
+
+// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="mod"]' 'hidden'
+#[doc(hidden)]
+pub mod hidden {
+ // @has 'foo/hidden/index.html'
+ // @has - '//*[@class="item-name"]/a[@class="fn"]' 'inside_hidden'
+ // @has 'foo/hidden/fn.inside_hidden.html'
+ pub fn inside_hidden() {}
+}