Closed
Description
This is similar to the same buggy behavior we saw for $:ident
matchers fixed in 1.20.0.
For example in Rust 1.19 the following code fails to compile with the message "expected ident, found @"
, but correctly prints ident
followed by other
as of 1.20.
macro_rules! m {
($ident:ident) => { println!("ident"); };
($other:tt) => { println!("other"); };
}
fn main() {
m!(ident);
m!(@);
}
The $:lifetime
matcher is currently broken in the same way.
macro_rules! m {
($lifetime:lifetime) => { println!("lifetime"); };
($other:tt) => { println!("other"); };
}
fn main() {
m!('lifetime);
m!(@);
}
error: expected a lifetime, found `@`
--> src/main.rs:8:8
|
8 | m!(@);
| ^
rustc 1.28.0-nightly (2a00629 2018-06-09)
Activity
lifetime
specifier tomacro_rules!
#34303dtolnay commentedon Jun 10, 2018
The ident issue was #27832, so mentioning @kennytm who fixed that one in #42913. Would you be interested in taking a look at this similar case?
kennytm commentedon Jun 10, 2018
Duplicate of #50903. @jrlusby should still be working on it I think?
dtolnay commentedon Jun 10, 2018
Thanks! Let's continue to track this as part of #50903.
Auto merge of #51480 - dtolnay:lifetime, r=kennytm