diff options
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index f1918817e..d171d2dfd 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use mbe::MacroRules; | 5 | use mbe::{ExpandResult, MacroRules}; |
6 | use ra_db::{salsa, SourceDatabase}; | 6 | use ra_db::{salsa, SourceDatabase}; |
7 | use ra_parser::FragmentKind; | 7 | use ra_parser::FragmentKind; |
8 | use ra_prof::profile; | 8 | use ra_prof::profile; |
@@ -31,12 +31,8 @@ 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 | 34 | TokenExpander::Builtin(it) => it.expand(db, id, tt).into(), |
35 | .expand(db, id, tt) | 35 | TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt).into(), |
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)), | ||
40 | } | 36 | } |
41 | } | 37 | } |
42 | 38 | ||
@@ -204,7 +200,7 @@ fn macro_expand_with_arg( | |||
204 | Some(it) => it, | 200 | Some(it) => it, |
205 | None => return (None, Some("Fail to find macro definition".into())), | 201 | None => return (None, Some("Fail to find macro definition".into())), |
206 | }; | 202 | }; |
207 | let (tt, err) = macro_rules.0.expand(db, lazy_id, ¯o_arg.0); | 203 | let ExpandResult(tt, err) = macro_rules.0.expand(db, lazy_id, ¯o_arg.0); |
208 | // Set a hard limit for the expanded tt | 204 | // Set a hard limit for the expanded tt |
209 | let count = tt.count(); | 205 | let count = tt.count(); |
210 | if count > 65536 { | 206 | if count > 65536 { |