mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #6774
6774: Increment recursion count in Expander only on success r=lnicola a=Veykril Fixes #6764 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
cd83ded8ee
1 changed files with 2 additions and 2 deletions
|
@ -103,8 +103,7 @@ impl Expander {
|
||||||
local_scope: Option<&ItemScope>,
|
local_scope: Option<&ItemScope>,
|
||||||
macro_call: ast::MacroCall,
|
macro_call: ast::MacroCall,
|
||||||
) -> ExpandResult<Option<(Mark, T)>> {
|
) -> ExpandResult<Option<(Mark, T)>> {
|
||||||
self.recursion_limit += 1;
|
if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT {
|
||||||
if self.recursion_limit > EXPANSION_RECURSION_LIMIT {
|
|
||||||
mark::hit!(your_stack_belongs_to_me);
|
mark::hit!(your_stack_belongs_to_me);
|
||||||
return ExpandResult::str_err("reached recursion limit during macro expansion".into());
|
return ExpandResult::str_err("reached recursion limit during macro expansion".into());
|
||||||
}
|
}
|
||||||
|
@ -165,6 +164,7 @@ impl Expander {
|
||||||
|
|
||||||
log::debug!("macro expansion {:#?}", node.syntax());
|
log::debug!("macro expansion {:#?}", node.syntax());
|
||||||
|
|
||||||
|
self.recursion_limit += 1;
|
||||||
let mark = Mark {
|
let mark = Mark {
|
||||||
file_id: self.current_file_id,
|
file_id: self.current_file_id,
|
||||||
ast_id_map: mem::take(&mut self.ast_id_map),
|
ast_id_map: mem::take(&mut self.ast_id_map),
|
||||||
|
|
Loading…
Reference in a new issue