Skip to content

Commit 137eee2

Browse files
authored
Merge pull request #21527 from ChayimFriedman2/builtin-macro-name
fix: Fix macro matching of `meta` then `=>` or `==`
2 parents ce2b2ae + 6ef381d commit 137eee2

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

crates/hir-def/src/macro_expansion_tests/mbe/matching.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,23 @@ fn test() {
237237
"#]],
238238
);
239239
}
240+
241+
#[test]
242+
fn meta_fat_arrow() {
243+
check(
244+
r#"
245+
macro_rules! m {
246+
( $m:meta => ) => {};
247+
}
248+
249+
m! { foo => }
250+
"#,
251+
expect![[r#"
252+
macro_rules! m {
253+
( $m:meta => ) => {};
254+
}
255+
256+
257+
"#]],
258+
);
259+
}

crates/parser/src/grammar/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub(super) fn meta(p: &mut Parser<'_>) {
7070
paths::attr_path(p);
7171

7272
match p.current() {
73-
T![=] => {
73+
T![=] if !p.at(T![=>]) && !p.at(T![==]) => {
7474
p.bump(T![=]);
7575
if expressions::expr(p).is_none() {
7676
p.error("expected expression");

0 commit comments

Comments
 (0)