about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-09 11:05:30 +0000
committerbors <bors@rust-lang.org>2022-04-09 11:05:30 +0000
commitfbdb10f9fabe47eb763cb4b52b5721740cc63783 (patch)
treedd3bd6dacdacbd30ee6a962cde4215d85a4c51fd /src/test/rustdoc
parent399dd8049d4b27329350937e3e17077205bdc0bf (diff)
parentece6b97f19d7c6e8c7def59898c693d17ec336fe (diff)
downloadrust-fbdb10f9fabe47eb763cb4b52b5721740cc63783.tar.gz
rust-fbdb10f9fabe47eb763cb4b52b5721740cc63783.zip
Auto merge of #95840 - Dylan-DPC:rollup-erz5u6w, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #95308 (Reduce the amount of unstable features used in libproc_macro)
 - #95676 (Update RLS)
 - #95769 (Hide cross-crate `#[doc(hidden)]` associated items in trait impls)
 - #95785 (interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal)
 - #95802 (fix unused constant warning on some Windows targets)
 - #95810 (Use `format-args-capture` and remove unnecessary nested blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs19
-rw-r--r--src/test/rustdoc/cross-crate-hidden-assoc-trait-items.rs23
2 files changed, 42 insertions, 0 deletions
diff --git a/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs b/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs
new file mode 100644
index 00000000000..3baf8a6c07e
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs
@@ -0,0 +1,19 @@
+pub trait Tr {
+    type VisibleAssoc;
+    #[doc(hidden)]
+    type HiddenAssoc;
+
+    const VISIBLE_ASSOC: ();
+    #[doc(hidden)]
+    const HIDDEN_ASSOC: ();
+}
+
+pub struct Ty;
+
+impl Tr for Ty {
+    type VisibleAssoc = ();
+    type HiddenAssoc = ();
+
+    const VISIBLE_ASSOC: () = ();
+    const HIDDEN_ASSOC: () = ();
+}
diff --git a/src/test/rustdoc/cross-crate-hidden-assoc-trait-items.rs b/src/test/rustdoc/cross-crate-hidden-assoc-trait-items.rs
new file mode 100644
index 00000000000..d02bc4fe712
--- /dev/null
+++ b/src/test/rustdoc/cross-crate-hidden-assoc-trait-items.rs
@@ -0,0 +1,23 @@
+// Regression test for issue #95717
+// Hide cross-crate `#[doc(hidden)]` associated items in trait impls.
+
+#![crate_name = "dependent"]
+// edition:2021
+// aux-crate:dependency=cross-crate-hidden-assoc-trait-items.rs
+
+// The trait `Tr` contains 2 hidden and 2 visisible associated items.
+// Instead of checking for the absence of the hidden items, check for the presence of the
+// visible items instead and assert that there are *exactly two* associated items
+// (by counting the number of `section`s). This is more robust and future-proof.
+
+// @has dependent/struct.Ty.html
+// @has - '//*[@id="associatedtype.VisibleAssoc"]' 'type VisibleAssoc = ()'
+// @has - '//*[@id="associatedconstant.VISIBLE_ASSOC"]' 'const VISIBLE_ASSOC: ()'
+// @count - '//*[@class="impl-items"]/section' 2
+
+// @has dependent/trait.Tr.html
+// @has - '//*[@id="associatedtype.VisibleAssoc-1"]' 'type VisibleAssoc = ()'
+// @has - '//*[@id="associatedconstant.VISIBLE_ASSOC-1"]' 'const VISIBLE_ASSOC: ()'
+// @count - '//*[@class="impl-items"]/section' 2
+
+pub use dependency::{Tr, Ty};