diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/body.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 8c233a717..2fe04db2b 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -46,6 +46,12 @@ pub(crate) struct Expander { | |||
46 | recursion_limit: usize, | 46 | recursion_limit: usize, |
47 | } | 47 | } |
48 | 48 | ||
49 | #[cfg(test)] | ||
50 | const EXPANSION_RECURSION_LIMIT: usize = 32; | ||
51 | |||
52 | #[cfg(not(test))] | ||
53 | const EXPANSION_RECURSION_LIMIT: usize = 128; | ||
54 | |||
49 | impl CfgExpander { | 55 | impl CfgExpander { |
50 | pub(crate) fn new( | 56 | pub(crate) fn new( |
51 | db: &dyn DefDatabase, | 57 | db: &dyn DefDatabase, |
@@ -93,7 +99,7 @@ impl Expander { | |||
93 | macro_call: ast::MacroCall, | 99 | macro_call: ast::MacroCall, |
94 | ) -> Option<(Mark, T)> { | 100 | ) -> Option<(Mark, T)> { |
95 | self.recursion_limit += 1; | 101 | self.recursion_limit += 1; |
96 | if self.recursion_limit > 32 { | 102 | if self.recursion_limit > EXPANSION_RECURSION_LIMIT { |
97 | mark::hit!(your_stack_belongs_to_me); | 103 | mark::hit!(your_stack_belongs_to_me); |
98 | return None; | 104 | return None; |
99 | } | 105 | } |
@@ -341,7 +347,7 @@ mod tests { | |||
341 | fn your_stack_belongs_to_me() { | 347 | fn your_stack_belongs_to_me() { |
342 | mark::check!(your_stack_belongs_to_me); | 348 | mark::check!(your_stack_belongs_to_me); |
343 | lower( | 349 | lower( |
344 | r" | 350 | " |
345 | macro_rules! n_nuple { | 351 | macro_rules! n_nuple { |
346 | ($e:tt) => (); | 352 | ($e:tt) => (); |
347 | ($($rest:tt)*) => {{ | 353 | ($($rest:tt)*) => {{ |