Better trace-macro and less span_err_fatal
This commit is contained in:
parent
8bb7dba9c7
commit
8b71e0bbd5
4 changed files with 15 additions and 41 deletions
|
|
@ -18,13 +18,13 @@ macro_rules! my_faulty_macro {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! nested_pat_macro {
|
||||
macro_rules! pat_macro {
|
||||
() => {
|
||||
nested_pat_macro!(inner);
|
||||
pat_macro!(A{a:a, b:0, c:_, ..});
|
||||
};
|
||||
($a:pat) => {
|
||||
$a
|
||||
};
|
||||
(inner) => {
|
||||
a | b | 1 ... 3 | _
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! my_recursive_macro {
|
||||
|
|
@ -41,11 +41,11 @@ macro_rules! my_macro {
|
|||
|
||||
fn main() {
|
||||
my_faulty_macro!();
|
||||
nested_pat_macro!();
|
||||
my_recursive_macro!();
|
||||
test!();
|
||||
non_exisiting!();
|
||||
derive!(Debug);
|
||||
let a = pat_macro!();
|
||||
}
|
||||
|
||||
#[my_macro]
|
||||
|
|
|
|||
|
|
@ -17,30 +17,21 @@ note: trace_macro
|
|||
= note: to `my_faulty_macro ! ( bcd ) ;`
|
||||
= note: expanding `my_faulty_macro! { bcd }`
|
||||
|
||||
error: expected expression, found `_`
|
||||
--> $DIR/trace_faulty_macros.rs:26:27
|
||||
|
|
||||
26 | a | b | 1 ... 3 | _
|
||||
| ^
|
||||
...
|
||||
44 | nested_pat_macro!();
|
||||
| -------------------- in this macro invocation
|
||||
|
||||
error: recursion limit reached while expanding the macro `my_recursive_macro`
|
||||
--> $DIR/trace_faulty_macros.rs:32:9
|
||||
|
|
||||
32 | my_recursive_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
45 | my_recursive_macro!();
|
||||
44 | my_recursive_macro!();
|
||||
| ---------------------- in this macro invocation
|
||||
|
|
||||
= help: consider adding a `#![recursion_limit="8"]` attribute to your crate
|
||||
|
||||
note: trace_macro
|
||||
--> $DIR/trace_faulty_macros.rs:45:5
|
||||
--> $DIR/trace_faulty_macros.rs:44:5
|
||||
|
|
||||
45 | my_recursive_macro!();
|
||||
44 | my_recursive_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expanding `my_recursive_macro! { }`
|
||||
|
|
@ -54,24 +45,4 @@ note: trace_macro
|
|||
= note: expanding `my_recursive_macro! { }`
|
||||
= note: to `my_recursive_macro ! ( ) ;`
|
||||
|
||||
note: trace_macro
|
||||
--> $DIR/trace_faulty_macros.rs:43:5
|
||||
|
|
||||
43 | my_faulty_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expanding `my_faulty_macro! { }`
|
||||
= note: to `my_faulty_macro ! ( bcd ) ;`
|
||||
= note: expanding `my_faulty_macro! { bcd }`
|
||||
|
||||
note: trace_macro
|
||||
--> $DIR/trace_faulty_macros.rs:44:5
|
||||
|
|
||||
44 | nested_pat_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expanding `nested_pat_macro! { }`
|
||||
= note: to `nested_pat_macro ! ( inner ) ;`
|
||||
= note: expanding `nested_pat_macro! { inner }`
|
||||
= note: to `a | b | 1 ... 3 | _`
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue