Closed
Description
When I updated to Rust master yesterday, some of my macro invocations broke in an interesting way. Here's a reduced example:
#![feature(macro_rules)]
macro_rules! my_macro(
($condition:expr $action:block) => ({})
)
fn main() {
my_macro!(0 == y {
y = 1;
});
}
$ rustc main.rs
main.rs:10:5: 10:6 error: expected `:` but found `=`
main.rs:10 y = 1;
^
With this workaround, it compiles without errors:
#![feature(macro_rules)]
macro_rules! my_macro(
($condition:expr $action:block) => ({})
)
fn main() {
my_macro!(0 == y && true {
y = 1;
});
}
Looks to me like the parser sees "y { ..." and mistakes it for a struct initialization.
This problem occurs with commit 2f74325.
Before the upgrade, it worked fine with commit db29814.