about summary refs log tree commit diff
path: root/tests/rustdoc/macro/macros.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-05 16:40:02 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-05 17:47:18 +0200
commitd1f4a0bcb60ab868c496ca72a28b48ac0a4128af (patch)
tree5f9dc3dd1df27f8d4a2f7f06950943cc4ab3cc5c /tests/rustdoc/macro/macros.rs
parenteee6c9753588fe1888d3ddb264f9516e7ac56997 (diff)
downloadrust-d1f4a0bcb60ab868c496ca72a28b48ac0a4128af.tar.gz
rust-d1f4a0bcb60ab868c496ca72a28b48ac0a4128af.zip
Created `tests/rustdoc/macro` subfolder to limit number of files at the top level
Diffstat (limited to 'tests/rustdoc/macro/macros.rs')
-rw-r--r--tests/rustdoc/macro/macros.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/rustdoc/macro/macros.rs b/tests/rustdoc/macro/macros.rs
new file mode 100644
index 00000000000..d08babc25f8
--- /dev/null
+++ b/tests/rustdoc/macro/macros.rs
@@ -0,0 +1,24 @@
+//@ has macros/macro.my_macro.html //pre 'macro_rules! my_macro {'
+//@ has - //pre '() => { ... };'
+//@ has - //pre '($a:tt) => { ... };'
+//@ has - //pre '($e:expr) => { ... };'
+#[macro_export]
+macro_rules! my_macro {
+    () => [];
+    ($a:tt) => ();
+    ($e:expr) => {};
+}
+
+// Check that exported macro defined in a module are shown at crate root.
+//@ has macros/macro.my_sub_macro.html //pre 'macro_rules! my_sub_macro {'
+//@ has - //pre '() => { ... };'
+//@ has - //pre '($a:tt) => { ... };'
+//@ has - //pre '($e:expr) => { ... };'
+mod sub {
+    #[macro_export]
+    macro_rules! my_sub_macro {
+        () => {};
+        ($a:tt) => {};
+        ($e:expr) => {};
+    }
+}