diff options
Diffstat (limited to 'crates/hir_expand/src/eager.rs')
-rw-r--r-- | crates/hir_expand/src/eager.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index 9093255f4..584ddcf9f 100644 --- a/crates/hir_expand/src/eager.rs +++ b/crates/hir_expand/src/eager.rs | |||
@@ -17,7 +17,7 @@ | |||
17 | //! > and we need to live with it because it's available on stable and widely relied upon. | 17 | //! > and we need to live with it because it's available on stable and widely relied upon. |
18 | //! | 18 | //! |
19 | //! | 19 | //! |
20 | //! See the full discussion : https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Eager.20expansion.20of.20built-in.20macros | 20 | //! See the full discussion : <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Eager.20expansion.20of.20built-in.20macros> |
21 | 21 | ||
22 | use crate::{ | 22 | use crate::{ |
23 | ast::{self, AstNode}, | 23 | ast::{self, AstNode}, |
@@ -128,7 +128,7 @@ pub fn expand_eager_macro( | |||
128 | }), | 128 | }), |
129 | kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr }, | 129 | kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr }, |
130 | }); | 130 | }); |
131 | let arg_file_id: MacroCallId = arg_id.into(); | 131 | let arg_file_id: MacroCallId = arg_id; |
132 | 132 | ||
133 | let parsed_args = | 133 | let parsed_args = |
134 | diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0; | 134 | diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0; |
@@ -177,13 +177,11 @@ fn lazy_expand( | |||
177 | let ast_id = db.ast_id_map(macro_call.file_id).ast_id(¯o_call.value); | 177 | let ast_id = db.ast_id_map(macro_call.file_id).ast_id(¯o_call.value); |
178 | 178 | ||
179 | let fragment = crate::to_fragment_kind(¯o_call.value); | 179 | let fragment = crate::to_fragment_kind(¯o_call.value); |
180 | let id: MacroCallId = def | 180 | let id: MacroCallId = def.as_lazy_macro( |
181 | .as_lazy_macro( | 181 | db, |
182 | db, | 182 | krate, |
183 | krate, | 183 | MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, |
184 | MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, | 184 | ); |
185 | ) | ||
186 | .into(); | ||
187 | 185 | ||
188 | let err = db.macro_expand_error(id); | 186 | let err = db.macro_expand_error(id); |
189 | let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node)); | 187 | let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node)); |
@@ -216,8 +214,7 @@ fn eager_macro_recur( | |||
216 | def, | 214 | def, |
217 | macro_resolver, | 215 | macro_resolver, |
218 | diagnostic_sink, | 216 | diagnostic_sink, |
219 | )? | 217 | )?; |
220 | .into(); | ||
221 | db.parse_or_expand(id.as_file()) | 218 | db.parse_or_expand(id.as_file()) |
222 | .expect("successful macro expansion should be parseable") | 219 | .expect("successful macro expansion should be parseable") |
223 | .clone_for_update() | 220 | .clone_for_update() |