forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#86484 - fee1-dead:builtin-macro-recursion, …
…r=petrochenkov Do not set depth to 0 in fully_expand_fragment Fixes rust-lang#84632.
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Regression test for #84632: Recursion limit is ignored | ||
// for builtin macros that eagerly expands. | ||
|
||
#![recursion_limit = "15"] | ||
macro_rules! a { | ||
() => (""); | ||
(A) => (concat!("", a!())); | ||
(A, $($A:ident),*) => (concat!("", a!($($A),*))) | ||
//~^ ERROR recursion limit reached | ||
//~| HELP consider adding | ||
} | ||
|
||
fn main() { | ||
a!(A, A, A, A, A); | ||
a!(A, A, A, A, A, A, A, A, A, A, A); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: recursion limit reached while expanding `concat!` | ||
--> $DIR/issue-84632-eager-expansion-recursion-limit.rs:8:28 | ||
| | ||
LL | (A, $($A:ident),*) => (concat!("", a!($($A),*))) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | a!(A, A, A, A, A, A, A, A, A, A, A); | ||
| ------------------------------------ in this macro invocation | ||
| | ||
= help: consider adding a `#![recursion_limit="30"]` attribute to your crate (`issue_84632_eager_expansion_recursion_limit`) | ||
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|