1
Fork 0
rust/src/test/ui/macros/trace_faulty_macros.rs

46 lines
717 B
Rust
Raw Normal View History

2017-09-02 17:21:13 +02:00
// compile-flags: -Z trace-macros
#![recursion_limit="4"]
macro_rules! my_faulty_macro {
() => {
2017-11-20 13:13:27 +01:00
my_faulty_macro!(bcd); //~ ERROR no rules
2017-09-02 17:21:13 +02:00
};
}
macro_rules! pat_macro {
2017-09-02 17:21:13 +02:00
() => {
pat_macro!(A{a:a, b:0, c:_, ..});
};
($a:pat) => {
2020-02-29 04:23:58 +01:00
$a //~ ERROR expected expression
2017-09-02 17:21:13 +02:00
};
}
macro_rules! my_recursive_macro {
() => {
2017-11-20 13:13:27 +01:00
my_recursive_macro!(); //~ ERROR recursion limit
2017-09-02 17:21:13 +02:00
};
}
macro_rules! my_macro {
() => {
2017-09-02 18:14:14 +02:00
2017-09-02 17:21:13 +02:00
};
}
fn main() {
my_faulty_macro!();
my_recursive_macro!();
test!();
non_exisiting!();
derive!(Debug);
let a = pat_macro!();
2017-09-02 17:21:13 +02:00
}
#[my_macro]
fn use_bang_macro_as_attr(){}
#[derive(Debug)]
fn use_derive_macro_as_attr(){}