about summary refs log tree commit diff
path: root/tests/rustdoc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/attributes-re-export.rs13
-rw-r--r--tests/rustdoc/reexport/extern-135092.rs26
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/rustdoc/attributes-re-export.rs b/tests/rustdoc/attributes-re-export.rs
new file mode 100644
index 00000000000..458826ea8a3
--- /dev/null
+++ b/tests/rustdoc/attributes-re-export.rs
@@ -0,0 +1,13 @@
+// Tests that attributes are correctly copied onto a re-exported item.
+//@ edition:2021
+#![crate_name = "re_export"]
+
+//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[no_mangle]'
+pub use thingymod::thingy as thingy2;
+
+mod thingymod {
+    #[no_mangle]
+    pub fn thingy() {
+
+    }
+}
diff --git a/tests/rustdoc/reexport/extern-135092.rs b/tests/rustdoc/reexport/extern-135092.rs
new file mode 100644
index 00000000000..fb5c71d56d5
--- /dev/null
+++ b/tests/rustdoc/reexport/extern-135092.rs
@@ -0,0 +1,26 @@
+// Test to make sure reexports of extern items are combined
+// <https://github.com/rust-lang/rust/issues/135092>
+
+#![crate_name = "foo"]
+
+mod native {
+    extern "C" {
+        /// bar.
+        pub fn bar();
+    }
+
+    /// baz.
+    pub fn baz() {}
+}
+
+//@ has 'foo/fn.bar.html'
+//@ has - '//div[@class="docblock"]' 'bar.'
+//@ has - '//div[@class="docblock"]' 'foo'
+/// foo
+pub use native::bar;
+
+//@ has 'foo/fn.baz.html'
+//@ has - '//div[@class="docblock"]' 'baz.'
+//@ has - '//div[@class="docblock"]' 'foo'
+/// foo
+pub use native::baz;