Skip to content

Commit

Permalink
Rollup merge of #107124 - DebugSteven:check-macro-expansion, r=albert…
Browse files Browse the repository at this point in the history
…larsan68

fix check macro expansion

If the only argument to `check!` is the module name I get this error:

```
error: expected expression, found `,`
   --> src/tools/tidy/src/main.rs:63:42
    |
57  | /         macro_rules! check {
58  | |             ($p:ident $(, $args:expr)* ) => {
59  | |                 drain_handles(&mut handles);
60  | |
...   |
63  | |                     $p::check($($args),* , &mut flag);
    | |                                          ^ expected expression
...   |
69  | |             }
70  | |         }
    | |_________- in this expansion of `check!`
...
117 |           check!(hey);
    |           ----------- in this macro invocation
```

This change makes it so commas are added only when there are `args`.

r? `@albertlarsan68`
  • Loading branch information
compiler-errors authored Jan 20, 2023
2 parents 644e0cc + a641b92 commit 222510e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main() {

let handle = s.spawn(|| {
let mut flag = false;
$p::check($($args),* , &mut flag);
$p::check($($args, )* &mut flag);
if (flag) {
bad.store(true, Ordering::Relaxed);
}
Expand Down

0 comments on commit 222510e

Please sign in to comment.