about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-02-14 18:30:21 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-02-14 23:23:59 +0100
commit1ec1d9481253ad828a648a2ca9a2556b6efd69cc (patch)
tree5b90dcb83c71c6e997213226af921dc7cb5a3845
parent02a845a8268e6c6ed45f8bf2e7748ec8208af650 (diff)
downloadrust-1ec1d9481253ad828a648a2ca9a2556b6efd69cc.tar.gz
rust-1ec1d9481253ad828a648a2ca9a2556b6efd69cc.zip
Add test for reexports attr merge
-rw-r--r--tests/rustdoc/reexport-attr-merge.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/rustdoc/reexport-attr-merge.rs b/tests/rustdoc/reexport-attr-merge.rs
new file mode 100644
index 00000000000..f1aee08c9c0
--- /dev/null
+++ b/tests/rustdoc/reexport-attr-merge.rs
@@ -0,0 +1,26 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/59368>.
+// The goal is to ensure that `doc(hidden)`, `doc(inline)` and `doc(no_inline`)
+
+#![crate_name = "foo"]
+#![feature(doc_cfg)]
+
+// @has 'foo/index.html'
+
+#[doc(hidden, cfg(feature = "foo"))]
+pub struct Foo;
+
+#[doc(hidden, no_inline, cfg(feature = "bar"))]
+pub use Foo as Foo1;
+
+#[doc(hidden, inline)]
+pub use Foo1 as Foo2;
+
+// First we ensure that none of the other items are generated.
+// @count - '//a[@class="struct"]' 1
+// Then we check that both `cfg` are displayed.
+// @has - '//*[@class="stab portability"]' 'foo'
+// @has - '//*[@class="stab portability"]' 'bar'
+// And finally we check that the only element displayed is `Bar`.
+// @has - '//a[@class="struct"]' 'Bar'
+#[doc(inline)]
+pub use Foo2 as Bar;