Merge pull request #21527 from ChayimFriedman2/builtin-macro-name

fix: Fix macro matching of `meta` then `=>` or `==`
This commit is contained in:
Shoyu Vanilla (Flint) 2026-01-27 12:02:41 +00:00 committed by GitHub
commit 4430fd8ef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -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 => ) => {};
}
"#]],
);
}

View file

@ -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");