Skip to content

Commit 3810719

Browse files
committed
Add test for #2558
When run against invalid macro definitions, rustfmt should leave them unchanged rather than panic.
1 parent e68682f commit 3810719

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/source/macro_rules.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,9 @@ macro_rules! binary {
188188
}
189189
};
190190
}
191+
192+
// #2558
193+
macro_rules! m {
194+
($x:) => {};
195+
($($foo:expr)()?) => {};
196+
}

tests/target/macro_rules.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,9 @@ macro_rules! binary {
220220
}
221221
};
222222
}
223+
224+
// #2558
225+
macro_rules! m {
226+
($x:) => {};
227+
($($foo:expr)()?) => {};
228+
}

0 commit comments

Comments
 (0)