Skip to content
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

Regression in formatting Syn's token macro #3331

Closed
dtolnay opened this issue Feb 7, 2019 · 1 comment
Closed

Regression in formatting Syn's token macro #3331

dtolnay opened this issue Feb 7, 2019 · 1 comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. p-high

Comments

@dtolnay
Copy link
Member

dtolnay commented Feb 7, 2019

Our CI hit a surprising formatting change: https://travis-ci.org/dtolnay/syn/jobs/490139618.

 #[cfg(any(feature = "full", feature = "derive"))]
 pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
     Abi {
-        extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
+        extern_token: Token ! [ extern ](tokens_helper(_visitor, &_i.extern_token.span)),
         name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
     }
 }

I minimized this to:

echo 'Token ! [ extern ];' | cargo run --bin rustfmt

Before f4f9502:

Token![extern];

Since f4f9502:

Token ! [ extern ];

Mentioning @topecongiro and @scampi who were involved in that PR.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. p-high a-macros labels Feb 8, 2019
@topecongiro
Copy link
Contributor

It looks like rustfmt fails to format a macro call whose argument is extern. Haven't confirmed, but I think that this is due to the recent change in the rustc parser (rust-lang/rust#57572).

topecongiro added a commit to topecongiro/rustfmt that referenced this issue Feb 8, 2019
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Feb 10, 2019
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. p-high
Projects
None yet
Development

No branches or pull requests

2 participants