-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team
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)
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team