Skip to content

Commit 0c79e1d

Browse files
committed
Add comment for parents logging
1 parent c7b0c72 commit 0c79e1d

File tree

1 file changed

+12
-7
lines changed
  • crates/ra_hir_expand/src

1 file changed

+12
-7
lines changed

crates/ra_hir_expand/src/db.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,21 @@ pub(crate) fn parse_macro(
176176
MacroCallId::LazyMacro(id) => {
177177
let loc: MacroCallLoc = db.lookup_intern_macro(id);
178178
let node = loc.kind.node(db);
179+
180+
// collect parent information for warning log
181+
let parents = std::iter::successors(loc.kind.file_id().call_node(db), |it| {
182+
it.file_id.call_node(db)
183+
})
184+
.map(|n| format!("{:#}", n.value))
185+
.collect::<Vec<_>>()
186+
.join("\n");
187+
179188
log::warn!(
180-
"fail on macro_parse: (reason: {} macro_call: {:#})",
189+
"fail on macro_parse: (reason: {} macro_call: {:#}) parents: {}",
181190
err,
182-
node.value
191+
node.value,
192+
parents
183193
);
184-
let mut parent = loc.kind.file_id().call_node(db);
185-
while let Some(node) = parent.clone() {
186-
log::warn!("parent: macro_call: {:#})", node.value);
187-
parent = node.file_id.call_node(db);
188-
}
189194
}
190195
_ => {
191196
log::warn!("fail on macro_parse: (reason: {})", err);

0 commit comments

Comments
 (0)