mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2026-03-09 19:49:09 +00:00
Fix macro matching of meta then => or ==
The parser declared it was invalid meta because it consumed the lone `=`, which is incorrect.
This commit is contained in:
parent
2532c48f1e
commit
6ef381d4e2
@ -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 => ) => {};
|
||||
}
|
||||
|
||||
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user