about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Schievink <jonas.schievink@ferrous-systems.com>2020-09-18 15:37:31 +0200
committerJonas Schievink <jonas.schievink@ferrous-systems.com>2020-09-18 15:37:31 +0200
commit9dc0afe854380f17bbec9100187ef3d3aa397f28 (patch)
tree72332355087da5fb9f518ae04a9fa73a4f93a70d
parent700a3d5d75cdc1b8b7049d35af335c638e079c5c (diff)
Rename `CustomDerive` to `ProcMacro`
It handles fn-like macros too, and will handle attribute macros in the
future
-rw-r--r--crates/hir/src/code_model.rs4
-rw-r--r--crates/hir_def/src/nameres/collector.rs2
-rw-r--r--crates/hir_expand/src/db.rs4
-rw-r--r--crates/hir_expand/src/eager.rs2
-rw-r--r--crates/hir_expand/src/hygiene.rs2
-rw-r--r--crates/hir_expand/src/lib.rs2
6 files changed, 8 insertions, 8 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 7a9747fc710..849c8f6d098 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -908,12 +908,12 @@ impl MacroDef {
 
     /// Indicate it is a proc-macro
     pub fn is_proc_macro(&self) -> bool {
-        matches!(self.id.kind, MacroDefKind::CustomDerive(_))
+        matches!(self.id.kind, MacroDefKind::ProcMacro(_))
     }
 
     /// Indicate it is a derive macro
     pub fn is_derive_macro(&self) -> bool {
-        matches!(self.id.kind, MacroDefKind::CustomDerive(_) | MacroDefKind::BuiltInDerive(_))
+        matches!(self.id.kind, MacroDefKind::ProcMacro(_) | MacroDefKind::BuiltInDerive(_))
     }
 }
 
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 925043aa9dc..4c3993ff01b 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -273,7 +273,7 @@ impl DefCollector<'_> {
             let macro_id = MacroDefId {
                 ast_id: None,
                 krate: Some(krate),
-                kind: MacroDefKind::CustomDerive(expander),
+                kind: MacroDefKind::ProcMacro(expander),
                 local_inner: false,
             };
 
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs
index 710694a3479..b591130ca4f 100644
--- a/crates/hir_expand/src/db.rs
+++ b/crates/hir_expand/src/db.rs
@@ -143,7 +143,7 @@ pub(crate) fn macro_def(
             Some(Arc::new((TokenExpander::BuiltinDerive(expander), mbe::TokenMap::default())))
         }
         MacroDefKind::BuiltInEager(_) => None,
-        MacroDefKind::CustomDerive(expander) => {
+        MacroDefKind::ProcMacro(expander) => {
             Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default())))
         }
     }
@@ -249,7 +249,7 @@ pub(crate) fn expand_proc_macro(
     };
 
     let expander = match loc.def.kind {
-        MacroDefKind::CustomDerive(expander) => expander,
+        MacroDefKind::ProcMacro(expander) => expander,
         _ => unreachable!(),
     };
 
diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs
index 10c45646f0d..2f37d7189c9 100644
--- a/crates/hir_expand/src/eager.rs
+++ b/crates/hir_expand/src/eager.rs
@@ -129,7 +129,7 @@ fn eager_macro_recur(
             MacroDefKind::Declarative
             | MacroDefKind::BuiltIn(_)
             | MacroDefKind::BuiltInDerive(_)
-            | MacroDefKind::CustomDerive(_) => {
+            | MacroDefKind::ProcMacro(_) => {
                 let expanded = lazy_expand(db, &def, curr.with_value(child.clone()), krate)?;
                 // replace macro inside
                 eager_macro_recur(db, expanded, krate, macro_resolver)?
diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs
index 845e9cbc19a..d383b968da1 100644
--- a/crates/hir_expand/src/hygiene.rs
+++ b/crates/hir_expand/src/hygiene.rs
@@ -33,7 +33,7 @@ impl Hygiene {
                         MacroDefKind::BuiltIn(_) => (None, false),
                         MacroDefKind::BuiltInDerive(_) => (None, false),
                         MacroDefKind::BuiltInEager(_) => (None, false),
-                        MacroDefKind::CustomDerive(_) => (None, false),
+                        MacroDefKind::ProcMacro(_) => (None, false),
                     }
                 }
                 MacroCallId::EagerMacro(_id) => (None, false),
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs
index 2be15e84132..17f1178ed70 100644
--- a/crates/hir_expand/src/lib.rs
+++ b/crates/hir_expand/src/lib.rs
@@ -246,7 +246,7 @@ pub enum MacroDefKind {
     // FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander
     BuiltInDerive(BuiltinDeriveExpander),
     BuiltInEager(EagerExpander),
-    CustomDerive(ProcMacroExpander),
+    ProcMacro(ProcMacroExpander),
 }
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]