diff options
Diffstat (limited to 'tests/rustdoc-gui/src')
| -rw-r--r-- | tests/rustdoc-gui/src/macro_expansion/Cargo.lock | 7 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/macro_expansion/Cargo.toml | 7 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/macro_expansion/lib.rs | 56 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/macro_expansion/other.rs | 6 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/test_docs/lib.rs | 4 |
5 files changed, 80 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/src/macro_expansion/Cargo.lock b/tests/rustdoc-gui/src/macro_expansion/Cargo.lock new file mode 100644 index 00000000000..9c5cee8fb9d --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "macro_expansion" +version = "0.1.0" diff --git a/tests/rustdoc-gui/src/macro_expansion/Cargo.toml b/tests/rustdoc-gui/src/macro_expansion/Cargo.toml new file mode 100644 index 00000000000..6d362850fc5 --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "macro_expansion" +version = "0.1.0" +edition = "2021" + +[lib] +path = "lib.rs" diff --git a/tests/rustdoc-gui/src/macro_expansion/lib.rs b/tests/rustdoc-gui/src/macro_expansion/lib.rs new file mode 100644 index 00000000000..62a92d5d15e --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/lib.rs @@ -0,0 +1,56 @@ +// Test crate used to check the `--generate-macro-expansion` option. +//@ compile-flags: -Zunstable-options --generate-macro-expansion --generate-link-to-definition + +mod other; + +#[macro_export] +macro_rules! bar { + ($x:ident) => {{ + $x += 2; + $x *= 2; + }} +} + +macro_rules! bar2 { + () => { + fn foo2() -> impl std::fmt::Display { + String::new() + } + } +} + +macro_rules! bar3 { + () => { + fn foo3() {} + fn foo4() -> String { String::new() } + } +} + +bar2!(); +bar3!(); + +#[derive(Debug, PartialEq)] +pub struct Bar; + +#[derive(Debug +)] +pub struct Bar2; + +fn y_f(_: &str, _: &str, _: &str) {} + +fn foo() { + let mut y = 0; + bar!(y); + println!(" + {y} + "); + // comment + println!(" + {y} + "); + let s = y_f("\ +bla", stringify!(foo), stringify!(bar)); + + // Macro from another file. + other_macro!(y); +} diff --git a/tests/rustdoc-gui/src/macro_expansion/other.rs b/tests/rustdoc-gui/src/macro_expansion/other.rs new file mode 100644 index 00000000000..8661b01be38 --- /dev/null +++ b/tests/rustdoc-gui/src/macro_expansion/other.rs @@ -0,0 +1,6 @@ +#[macro_export] +macro_rules! other_macro { + ($x:ident) => {{ + $x += 2; + }} +} diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index 623f5b33e9b..42f2fbd93b1 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -161,6 +161,10 @@ pub enum AnEnum { /// Some keyword. pub mod keyword {} +#[doc(attribute = "forbid")] +/// Some attribute. +pub mod repr {} + /// Just some type alias. pub type SomeType = u32; |
