Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | crates/hir-def/src/macro_expansion_tests/mbe/matching.rs | 20 | ||||
| -rw-r--r-- | crates/parser/src/grammar/attributes.rs | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mbe/matching.rs b/crates/hir-def/src/macro_expansion_tests/mbe/matching.rs index e33a366769..bbadcf8794 100644 --- a/crates/hir-def/src/macro_expansion_tests/mbe/matching.rs +++ b/crates/hir-def/src/macro_expansion_tests/mbe/matching.rs @@ -237,3 +237,23 @@ fn test() { "#]], ); } + +#[test] +fn meta_fat_arrow() { + check( + r#" +macro_rules! m { + ( $m:meta => ) => {}; +} + +m! { foo => } + "#, + expect![[r#" +macro_rules! m { + ( $m:meta => ) => {}; +} + + + "#]], + ); +} diff --git a/crates/parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs index 54b5c8a275..c0cf43a87b 100644 --- a/crates/parser/src/grammar/attributes.rs +++ b/crates/parser/src/grammar/attributes.rs @@ -70,7 +70,7 @@ pub(super) fn meta(p: &mut Parser<'_>) { paths::attr_path(p); match p.current() { - T![=] => { + T![=] if !p.at(T![=>]) && !p.at(T![==]) => { p.bump(T![=]); if expressions::expr(p).is_none() { p.error("expected expression"); |