rust/tests/ui/macros/stmt_expr_attr_macro_parse.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
449 B
Rust
Raw Normal View History

// run-pass
#![allow(unused_macro_rules)]
2015-11-24 13:56:20 +00:00
macro_rules! m {
($e:expr) => {
"expr includes attr"
};
(#[$attr:meta] $e:expr) => {
"expr excludes attr"
}
}
2015-11-24 22:03:10 +00:00
macro_rules! n {
(#[$attr:meta] $e:expr) => {
"expr excludes attr"
};
($e:expr) => {
"expr includes attr"
}
}
2015-11-24 13:56:20 +00:00
fn main() {
2015-11-24 22:03:10 +00:00
assert_eq!(m!(#[attr] 1), "expr includes attr");
assert_eq!(n!(#[attr] 1), "expr excludes attr");
2015-11-24 13:56:20 +00:00
}