diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-01 16:57:39 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-23 00:57:29 +0200 |
| commit | 0e9b126695847418a681b96b87b5976fb069394a (patch) | |
| tree | a162b2114f5f63c4210d2a0737fb99060bfc1871 /tests/rustdoc | |
| parent | bd5f3d76789028e0cdb432ff20f744b6fb24efc2 (diff) | |
| download | rust-0e9b126695847418a681b96b87b5976fb069394a.tar.gz rust-0e9b126695847418a681b96b87b5976fb069394a.zip | |
Also support statements and patterns for macro expansion
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/macro/macro_expansion.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/rustdoc/macro/macro_expansion.rs b/tests/rustdoc/macro/macro_expansion.rs new file mode 100644 index 00000000000..c989ccad967 --- /dev/null +++ b/tests/rustdoc/macro/macro_expansion.rs @@ -0,0 +1,28 @@ +// This test checks that patterns and statements are also getting expanded. + +//@ compile-flags: -Zunstable-options --generate-macro-expansion + +#![crate_name = "foo"] + +//@ has 'src/foo/macro_expansion.rs.html' +//@ count - '//span[@class="expansion"]' 2 + +macro_rules! pat { + ($x:literal) => { + Some($x) + } +} + +macro_rules! stmt { + ($x:expr) => {{ + let _ = $x; + }} +} + +fn bar() { + match Some("hello") { + pat!("blolb") => {} + _ => {} + } + stmt!(1) +} |
