Do not set depth to 0 in fully_expand_fragment
This commit is contained in:
parent
192920c22b
commit
37d0d2705d
3 changed files with 31 additions and 1 deletions
|
@ -427,7 +427,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
pub fn fully_expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment {
|
||||
let orig_expansion_data = self.cx.current_expansion.clone();
|
||||
let orig_force_mode = self.cx.force_mode;
|
||||
self.cx.current_expansion.depth = 0;
|
||||
|
||||
// Collect all macro invocations and replace them with placeholders.
|
||||
let (mut fragment_with_placeholders, mut invocations) =
|
||||
|
@ -488,6 +487,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
};
|
||||
|
||||
let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data;
|
||||
let depth = depth - orig_expansion_data.depth;
|
||||
self.cx.current_expansion = invoc.expansion_data.clone();
|
||||
self.cx.force_mode = force;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue