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
450 B
Rust
Raw Normal View History

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