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

Panic on <- in macro invocation #2953

Closed
dtolnay opened this issue Aug 24, 2018 · 0 comments
Closed

Panic on <- in macro invocation #2953

dtolnay opened this issue Aug 24, 2018 · 0 comments
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 24, 2018

I am trying to write a macro where the input syntax is $a:ident <- $b:expr (unrelated to the old placement expression syntax). Rustfmt sees this as placement, decides to format the macro input as a placement expression, and hits an unimplemented!().

macro_rules! demo {
    ($a:ident <- $b:expr) => {};
}

fn main() {
    demo!(i <- 0);
}
thread 'main' panicked at 'not yet implemented', tools/rustfmt/src/expr.rs:347:47
note: Run with `RUST_BACKTRACE=1` for a backtrace.

If we don't want to implement formatting for actual placement expressions (#2743), at least inside of macro input rustfmt should let them go and not treat them as expressions at all.

@nrc nrc added the bug Panic, non-idempotency, invalid code, etc. label Aug 24, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Aug 26, 2018
@nrc nrc closed this as completed in #2966 Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants