diff options
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index e7b81a1e6..ad4a0732e 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -31,8 +31,12 @@ impl TokenExpander { | |||
31 | match self { | 31 | match self { |
32 | TokenExpander::MacroRules(it) => it.expand(tt), | 32 | TokenExpander::MacroRules(it) => it.expand(tt), |
33 | // FIXME switch these to ExpandResult as well | 33 | // FIXME switch these to ExpandResult as well |
34 | TokenExpander::Builtin(it) => it.expand(db, id, tt).map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)), | 34 | TokenExpander::Builtin(it) => it |
35 | TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt).map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)), | 35 | .expand(db, id, tt) |
36 | .map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)), | ||
37 | TokenExpander::BuiltinDerive(it) => it | ||
38 | .expand(db, id, tt) | ||
39 | .map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)), | ||
36 | } | 40 | } |
37 | } | 41 | } |
38 | 42 | ||
@@ -182,7 +186,7 @@ fn macro_expand_with_arg( | |||
182 | if arg.is_some() { | 186 | if arg.is_some() { |
183 | return ( | 187 | return ( |
184 | None, | 188 | None, |
185 | Some("hypothetical macro expansion not implemented for eager macro".to_owned()) | 189 | Some("hypothetical macro expansion not implemented for eager macro".to_owned()), |
186 | ); | 190 | ); |
187 | } else { | 191 | } else { |
188 | return (Some(db.lookup_intern_eager_expansion(id).subtree), None); | 192 | return (Some(db.lookup_intern_eager_expansion(id).subtree), None); |
@@ -252,9 +256,9 @@ pub fn parse_macro_with_arg( | |||
252 | let parents = std::iter::successors(loc.kind.file_id().call_node(db), |it| { | 256 | let parents = std::iter::successors(loc.kind.file_id().call_node(db), |it| { |
253 | it.file_id.call_node(db) | 257 | it.file_id.call_node(db) |
254 | }) | 258 | }) |
255 | .map(|n| format!("{:#}", n.value)) | 259 | .map(|n| format!("{:#}", n.value)) |
256 | .collect::<Vec<_>>() | 260 | .collect::<Vec<_>>() |
257 | .join("\n"); | 261 | .join("\n"); |
258 | 262 | ||
259 | log::warn!( | 263 | log::warn!( |
260 | "fail on macro_parse: (reason: {} macro_call: {:#}) parents: {}", | 264 | "fail on macro_parse: (reason: {} macro_call: {:#}) parents: {}", |