diff options
| author | Ralf Jung <post@ralfj.de> | 2020-12-18 16:22:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-18 16:22:09 +0100 |
| commit | 926999513e7d3f2cf62421e7a50b2bdf8d5ced9e (patch) | |
| tree | 1c5b1caa910f9a02b1138734b72cd6b214740c89 /src | |
| parent | 5eb15267ae30b617d6fb2555d33e79eca78ad156 (diff) | |
| parent | d6f1787447e1132d929efbb5b772be232e336c23 (diff) | |
| download | rust-926999513e7d3f2cf62421e7a50b2bdf8d5ced9e.tar.gz rust-926999513e7d3f2cf62421e7a50b2bdf8d5ced9e.zip | |
Rollup merge of #80135 - camelid:const-macro-nt, r=petrochenkov
Don't allow `const` to begin a nonterminal Fixes #79908. Thanks to Vadim Petrochenkov who [told me what the fix was][z]! [z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422 r? ``@petrochenkov``
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/inline-const/macro-with-const.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/inline-const/macro-with-const.rs b/src/test/ui/inline-const/macro-with-const.rs new file mode 100644 index 00000000000..e7393166d8d --- /dev/null +++ b/src/test/ui/inline-const/macro-with-const.rs @@ -0,0 +1,20 @@ +// check-pass + +macro_rules! exp { + (const $n:expr) => { + $n + }; +} + +macro_rules! stmt { + (exp $e:expr) => { + $e + }; + (exp $($t:tt)+) => { + exp!($($t)+) + }; +} + +fn main() { + stmt!(exp const 1); +} |
