-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rustfmt causes compilation error by inserting illegal trailing comma in macro #4675
Labels
Milestone
Comments
calebcartwright
added
the
1x-backport:pending
Fixed/resolved in source but not yet backported to a 1x branch and release
label
Jan 29, 2021
calebcartwright
added
1x-backport:completed
and removed
1x-backport:pending
Fixed/resolved in source but not yet backported to a 1x branch and release
labels
Jan 29, 2021
@calebcartwright Thanks for fixing this so quickly! |
Sure! It was really just a case of exceptionally fortuitous timing, as this popped up right as I was preparing to update rustfmt on nightly and it only needed a trivial fix. Any future issues will almost certainly not have the same turnaround 😄 |
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Jan 30, 2021
…anxiyn update rustfmt to v1.4.34 Short summary: Various formatting fixes (several const generic related) and introduction of `imports_granularity` config option Long summary copied from changelog: #### Changed - `merge_imports` configuration has been deprecated in favor of the new `imports_granularity` option. Any existing usage of `merge_imports` will be automatically mapped to the corresponding value on `imports_granularity` with a warning message printed to encourage users to update their config files. #### Added - New `imports_granularity` option has been added which succeeds `merge_imports`. This new option supports several additional variants which allow users to merge imports at different levels (crate or module), and even flatten imports to have a single use statement per item. ([PR rust-lang/rustfmt#4634](rust-lang/rustfmt#4634), [PR rust-lang/rustfmt#4639](rust-lang/rustfmt#4639)) See the section on the configuration site for more information https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#imports_granularity #### Fixed - Fix erroneous removal of `const` keyword on const trait impl ([rust-lang/rustfmt#4084](rust-lang/rustfmt#4084)) - Fix incorrect span usage wit const generics in supertraits ([rust-lang/rustfmt#4204](rust-lang/rustfmt#4204)) - Use correct span for const generic params ([rust-lang/rustfmt#4263](rust-lang/rustfmt#4263)) - Correct span on const generics to include type bounds ([rust-lang/rustfmt#4310](rust-lang/rustfmt#4310)) - Idempotence issue on blocks containing only empty statements ([rust-lang/rustfmt#4627](rust-lang/rustfmt#4627) and [rust-lang#3868](rust-lang/rustfmt#3868)) - Fix issue with semicolon placement on required functions that have a trailing comment that ends in a line-style comment before the semicolon ([rust-lang/rustfmt#4646](rust-lang/rustfmt#4646)) - Avoid shared interned cfg_if symbol since rustfmt can re-initialize the rustc_ast globals on multiple inputs ([rust-lang/rustfmt#4656](rust-lang/rustfmt#4656)) - Don't insert trailing comma on (base-less) rest in struct literals within macros ([rust-lang/rustfmt#4675](rust-lang/rustfmt#4675))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Struct patterns that end with
..
can't have a trailing comma. However, rustfmt on nightly inserts one withinmacro_rules!
.To Reproduce
Run
rustup default nightly
, then format this code:Expected behavior
The comma should not be inserted to ensure that expanded code compiles.
Meta
rustfmt 1.4.32-nightly (216a643 2021-01-16)
cargo fmt
or with rust-analyzer (makes no difference)The text was updated successfully, but these errors were encountered: