diff options
author | Aleksey Kladov <[email protected]> | 2020-07-11 19:01:56 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-11 19:01:56 +0100 |
commit | b4443b0398debdae312c4a5c48e2093c6769d552 (patch) | |
tree | 44f330d66de563708d964c354bf8afafcc8670ba /crates | |
parent | a8891ae3ca1f23ef310a91b2e30bac7e08be4aa1 (diff) |
Bump macro recursion limit in release
Diffstat (limited to 'crates')
-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)*) => {{ |