5320: Bump macro recursion limit in release r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-11 18:02:33 +00:00 committed by GitHub
commit 00c81f8006
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,12 @@ pub(crate) struct Expander {
recursion_limit: usize, recursion_limit: usize,
} }
#[cfg(test)]
const EXPANSION_RECURSION_LIMIT: usize = 32;
#[cfg(not(test))]
const EXPANSION_RECURSION_LIMIT: usize = 128;
impl CfgExpander { impl CfgExpander {
pub(crate) fn new( pub(crate) fn new(
db: &dyn DefDatabase, db: &dyn DefDatabase,
@ -93,7 +99,7 @@ impl Expander {
macro_call: ast::MacroCall, macro_call: ast::MacroCall,
) -> Option<(Mark, T)> { ) -> Option<(Mark, T)> {
self.recursion_limit += 1; self.recursion_limit += 1;
if self.recursion_limit > 32 { if self.recursion_limit > EXPANSION_RECURSION_LIMIT {
mark::hit!(your_stack_belongs_to_me); mark::hit!(your_stack_belongs_to_me);
return None; return None;
} }
@ -341,7 +347,7 @@ mod tests {
fn your_stack_belongs_to_me() { fn your_stack_belongs_to_me() {
mark::check!(your_stack_belongs_to_me); mark::check!(your_stack_belongs_to_me);
lower( lower(
r" "
macro_rules! n_nuple { macro_rules! n_nuple {
($e:tt) => (); ($e:tt) => ();
($($rest:tt)*) => {{ ($($rest:tt)*) => {{