aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ids.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index c7849c995..b0e9b1f9a 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -128,8 +128,14 @@ pub struct MacroDefId(pub(crate) AstId<ast::MacroCall>);
128pub(crate) fn macro_def_query(db: &impl DefDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> { 128pub(crate) fn macro_def_query(db: &impl DefDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> {
129 let macro_call = id.0.to_node(db); 129 let macro_call = id.0.to_node(db);
130 let arg = macro_call.token_tree()?; 130 let arg = macro_call.token_tree()?;
131 let (tt, _) = mbe::ast_to_token_tree(arg)?; 131 let (tt, _) = mbe::ast_to_token_tree(arg).or_else(|| {
132 let rules = MacroRules::parse(&tt).ok()?; 132 log::warn!("fail on macro_def to token tree: {:#?}", arg);
133 None
134 })?;
135 let rules = MacroRules::parse(&tt).ok().or_else(|| {
136 log::warn!("fail on macro_def parse: {:#?}", tt);
137 None
138 })?;
133 Some(Arc::new(rules)) 139 Some(Arc::new(rules))
134} 140}
135 141