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

Binary operator can duplicate itself in certain situations in a macro #2290

Closed
KamilaBorowska opened this issue Dec 18, 2017 · 2 comments
Closed
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.

Comments

@KamilaBorowska
Copy link

KamilaBorowska commented Dec 18, 2017

Example code:

m!(a: b!(c!) % f);

Is formatted into:

m!(a: b!(c!) % % f);

Which is not identical.

Noticed with https://github.com/xfix/advent-of-code-2017/blob/master/day18/src/main.rs with >> operator, and simplified.

This happens on playpen.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. a-macros labels Dec 18, 2017
@topecongiro
Copy link
Contributor

This is likely due to a bug in libsyntax parser.

kennytm added a commit to kennytm/rust that referenced this issue Dec 20, 2017
…cation-in-type, r=petrochenkov

Remove a token after closing delimiter from the span of macro in type position

e.g.
```rust
let x = y: foo!();
```
The span for `foo!()` includes `;`.

cc rust-lang/rustfmt#2290.
@topecongiro
Copy link
Contributor

Fixed on rustc 1.24.0-nightly (7eb64b86c 2017-12-20).

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.
Projects
None yet
Development

No branches or pull requests

2 participants