Skip to content

Commit d2e441a

Browse files
committed
fix: #[should_panic] breaks multiple #[ignore]
If a `#[should_panic]` was parsed before a duplicate `#[ignore]`, then the duplicate `#[ignore]` would lead to an "unknown attribute" compilation error.
1 parent fcfc13a commit d2e441a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/libtest2/src/macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ macro_rules! _test_parse {
4747
);
4848
};
4949
// Ignore subsequent calls to `#[ignore]`/`#[ignore = ".."]`
50-
(continue: name=$name:ident body=[$($item:tt)*] attrs=[#[ignore $(= $reason:literal)?] $(#[$($attr:tt)+])*] ignore=$ignore:tt) => {
50+
(continue: name=$name:ident body=[$($item:tt)*] attrs=[#[ignore $(= $reason:literal)?] $(#[$($attr:tt)+])*] ignore=$ignore:tt $(should_panic=$should_panic:tt)?) => {
5151
$crate::_private::test_parse!(continue:
5252
name=$name
5353
body=[$($item)*]
5454
attrs=[$(#[$($attr)*])*]
5555
ignore=$ignore
56+
$(should_panic=$should_panic)?
5657
);
5758
};
5859
// Process `#[should_panic]`/`#[should_panic = ".."]` (NOTE: This will only match if a should_panic macro has not already been parsed)

0 commit comments

Comments
 (0)