Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/lib.rs')
| -rw-r--r-- | crates/hir_def/src/lib.rs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index c38b498b9c..db1e65d080 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs @@ -64,11 +64,11 @@ use hir_expand::{ eager::{expand_eager_macro, ErrorEmitted, ErrorSink}, hygiene::Hygiene, AstId, ExpandTo, HirFileId, InFile, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, + UnresolvedMacro, }; use item_tree::ExternBlock; use la_arena::Idx; use nameres::DefMap; -use path::ModPath; use stdx::impl_from; use syntax::ast; @@ -677,7 +677,8 @@ impl AsMacroCall for InFile<&ast::MacroCall> { let expands_to = hir_expand::ExpandTo::from_call_site(self.value); let ast_id = AstId::new(self.file_id, db.ast_id_map(self.file_id).ast_id(self.value)); let h = Hygiene::new(db.upcast(), self.file_id); - let path = self.value.path().and_then(|path| path::ModPath::from_src(db, path, &h)); + let path = + self.value.path().and_then(|path| path::ModPath::from_src(db.upcast(), path, &h)); let path = match error_sink .option(path, || mbe::ExpandError::Other("malformed macro invocation".into())) @@ -712,11 +713,6 @@ impl<T: ast::AstNode> AstIdWithPath<T> { } } -#[derive(Debug)] -pub struct UnresolvedMacro { - pub path: ModPath, -} - fn macro_call_as_call_id( call: &AstIdWithPath<ast::MacroCall>, expand_to: ExpandTo, @@ -730,16 +726,8 @@ fn macro_call_as_call_id( let res = if let MacroDefKind::BuiltInEager(..) = def.kind { let macro_call = InFile::new(call.ast_id.file_id, call.ast_id.to_node(db.upcast())); - let hygiene = Hygiene::new(db.upcast(), call.ast_id.file_id); - expand_eager_macro( - db.upcast(), - krate, - macro_call, - def, - &|path: ast::Path| resolver(path::ModPath::from_src(db, path, &hygiene)?), - error_sink, - ) + expand_eager_macro(db.upcast(), krate, macro_call, def, &resolver, error_sink)? } else { Ok(def.as_lazy_macro( db.upcast(), |