From 54c78c96dbe61c2f1b6ec9f83a35a8ad6f6ae4fe Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 19 Mar 2021 14:23:13 +0100 Subject: Rename derive-specific APIs --- crates/hir_def/src/lib.rs | 4 ++-- crates/hir_def/src/nameres.rs | 4 ++-- crates/hir_def/src/nameres/collector.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 50e730444..c9e07de86 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs @@ -673,7 +673,7 @@ fn macro_call_as_call_id( Ok(res) } -fn item_attr_as_call_id( +fn derive_macro_as_call_id( item_attr: &AstIdWithPath, db: &dyn db::DefDatabase, krate: CrateId, @@ -685,7 +685,7 @@ fn item_attr_as_call_id( .as_lazy_macro( db.upcast(), krate, - MacroCallKind::Attr(item_attr.ast_id, last_segment.to_string()), + MacroCallKind::Derive(item_attr.ast_id, last_segment.to_string()), ) .into(); Ok(res) diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index 1ac326f97..0d3a0b54f 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs @@ -575,7 +575,7 @@ mod diagnostics { let node = ast.to_node(db.upcast()); (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node)), None) } - MacroCallKind::Attr(ast, name) => { + MacroCallKind::Derive(ast, name) => { let node = ast.to_node(db.upcast()); // Compute the precise location of the macro name's token in the derive @@ -631,7 +631,7 @@ mod diagnostics { let node = ast.to_node(db.upcast()); (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) } - MacroCallKind::Attr(ast, _) => { + MacroCallKind::Derive(ast, _) => { let node = ast.to_node(db.upcast()); (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) } diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index dcedf7766..4bcdc0fc8 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -22,7 +22,7 @@ use syntax::ast; use crate::{ attr::Attrs, db::DefDatabase, - item_attr_as_call_id, + derive_macro_as_call_id, item_scope::{ImportType, PerNsGlobImports}, item_tree::{ self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroRules, Mod, ModItem, ModKind, @@ -820,8 +820,8 @@ impl DefCollector<'_> { true }); attribute_macros.retain(|directive| { - match item_attr_as_call_id(&directive.ast_id, self.db, self.def_map.krate, |path| { - self.resolve_attribute_macro(&directive, &path) + match derive_macro_as_call_id(&directive.ast_id, self.db, self.def_map.krate, |path| { + self.resolve_derive_macro(&directive, &path) }) { Ok(call_id) => { resolved.push((directive.module_id, call_id, 0)); @@ -844,7 +844,7 @@ impl DefCollector<'_> { res } - fn resolve_attribute_macro( + fn resolve_derive_macro( &self, directive: &DeriveDirective, path: &ModPath, -- cgit v1.2.3