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

ItemMacro2 parenthesis needs to be optional #548

Closed
dtolnay opened this issue Dec 15, 2018 · 1 comment
Closed

ItemMacro2 parenthesis needs to be optional #548

dtolnay opened this issue Dec 15, 2018 · 1 comment

Comments

@dtolnay
Copy link
Owner

dtolnay commented Dec 15, 2018

We currently fail to parse src/libstd/sys/sgx/waitqueue.rs:

pub macro try_lock_or_false {
    ($e:expr) => {
        if let Some(v) = $e.try_lock() {
            v
        } else {
            return false
        }
    }
}
error: expected parentheses
  --> src/libstd/sys/sgx/waitqueue.rs:469:33
   |
   |       pub macro try_lock_or_false {
   |  _________________________________^
   | |         ($e:expr) => {
   | |             if let Some(v) = $e.try_lock() {
   | |                 v
...  |
   | |         }
   | |     }
   | |_____^

The parser for syn::ItemMacro2 is expecting decl macro syntax that looks like:

pub macro try_lock_or_false($e:expr) {
    /* ... */
}
@dtolnay dtolnay added the syntax label Dec 15, 2018
@dtolnay dtolnay added this to the 1.0 milestone Mar 10, 2019
@dtolnay
Copy link
Owner Author

dtolnay commented Jul 28, 2019

Fixed in e80823d.

@dtolnay dtolnay closed this as completed Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant