From c31c3246a8c87a3639623c30b692a57e728bb046 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 15 Dec 2020 18:43:19 +0100 Subject: Basic support for decl macros 2.0 --- crates/hir/src/has_source.rs | 4 ++-- crates/hir/src/semantics/source_to_def.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index 107ad0690..ecf3194c6 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -110,8 +110,8 @@ impl HasSource for TypeAlias { } } impl HasSource for MacroDef { - type Ast = ast::MacroRules; - fn source(self, db: &dyn HirDatabase) -> InFile { + type Ast = ast::Macro; + fn source(self, db: &dyn HirDatabase) -> InFile { InFile { file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id, value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()), diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index a333d7aea..d499ae340 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -157,7 +157,7 @@ impl SourceToDefCtx<'_, '_> { let file_id = src.file_id.original_file(self.db.upcast()); let krate = self.file_to_def(file_id)?.krate; let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value); - let ast_id = Some(AstId::new(src.file_id, file_ast_id)); + let ast_id = Some(AstId::new(src.file_id, file_ast_id.upcast())); Some(MacroDefId { krate: Some(krate), ast_id, kind, local_inner: false }) } -- cgit v1.2.3