rustfmt
rustfmt copied to clipboard
rustfmt removes parenthesis in macro call
In the following snippet: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9b0e4357d4c32e40b179c243c6861f6c
macro_rules! mymacro {
($tt1:tt $(+ $tt2:tt)*) => {
fn foo<F>(f: F)
where
F: $tt1 $(+ $tt2)*
{}
}
}
mymacro!((for<'a> Fn()) + Send + Sync);
rustfmt removes paren in the following macro call:
mymacro!((for<'a> Fn()) + Send + Sync);
so that it gets turned into:
mymacro!(for<'a> Fn() + Send + Sync);
Unfortunately, the latter is not equivalent and does not compile
Thanks for the report. In the more immediate term you may just want to change the call site delims to {} or [] to prevent this from occurring, or if you're using nightly, leverage the skip_macro_invocations option with my macro for the same
@rustbot claim