mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
mbe: Add a test checking for infinite recursion in macro attributes
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(macro_attr)]
|
||||
|
||||
macro_rules! attr {
|
||||
attr() { $($body:tt)* } => {
|
||||
#[attr] $($body)*
|
||||
};
|
||||
//~^^ ERROR: recursion limit reached
|
||||
}
|
||||
|
||||
#[attr]
|
||||
struct S;
|
||||
@@ -0,0 +1,14 @@
|
||||
error: recursion limit reached while expanding `#[attr]`
|
||||
--> $DIR/macro-rules-attr-infinite-recursion.rs:6:9
|
||||
|
|
||||
LL | #[attr] $($body)*
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | #[attr]
|
||||
| ------- in this attribute macro expansion
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`macro_rules_attr_infinite_recursion`)
|
||||
= note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Reference in New Issue
Block a user