Skip to content

Commit 9dc0afe

Browse files
author
Jonas Schievink
committed
Rename CustomDerive to ProcMacro
It handles fn-like macros too, and will handle attribute macros in the future
1 parent 700a3d5 commit 9dc0afe

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

crates/hir/src/code_model.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,12 @@ impl MacroDef {
908908

909909
/// Indicate it is a proc-macro
910910
pub fn is_proc_macro(&self) -> bool {
911-
matches!(self.id.kind, MacroDefKind::CustomDerive(_))
911+
matches!(self.id.kind, MacroDefKind::ProcMacro(_))
912912
}
913913

914914
/// Indicate it is a derive macro
915915
pub fn is_derive_macro(&self) -> bool {
916-
matches!(self.id.kind, MacroDefKind::CustomDerive(_) | MacroDefKind::BuiltInDerive(_))
916+
matches!(self.id.kind, MacroDefKind::ProcMacro(_) | MacroDefKind::BuiltInDerive(_))
917917
}
918918
}
919919

crates/hir_def/src/nameres/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl DefCollector<'_> {
273273
let macro_id = MacroDefId {
274274
ast_id: None,
275275
krate: Some(krate),
276-
kind: MacroDefKind::CustomDerive(expander),
276+
kind: MacroDefKind::ProcMacro(expander),
277277
local_inner: false,
278278
};
279279

crates/hir_expand/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub(crate) fn macro_def(
143143
Some(Arc::new((TokenExpander::BuiltinDerive(expander), mbe::TokenMap::default())))
144144
}
145145
MacroDefKind::BuiltInEager(_) => None,
146-
MacroDefKind::CustomDerive(expander) => {
146+
MacroDefKind::ProcMacro(expander) => {
147147
Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default())))
148148
}
149149
}
@@ -249,7 +249,7 @@ pub(crate) fn expand_proc_macro(
249249
};
250250

251251
let expander = match loc.def.kind {
252-
MacroDefKind::CustomDerive(expander) => expander,
252+
MacroDefKind::ProcMacro(expander) => expander,
253253
_ => unreachable!(),
254254
};
255255

crates/hir_expand/src/eager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn eager_macro_recur(
129129
MacroDefKind::Declarative
130130
| MacroDefKind::BuiltIn(_)
131131
| MacroDefKind::BuiltInDerive(_)
132-
| MacroDefKind::CustomDerive(_) => {
132+
| MacroDefKind::ProcMacro(_) => {
133133
let expanded = lazy_expand(db, &def, curr.with_value(child.clone()), krate)?;
134134
// replace macro inside
135135
eager_macro_recur(db, expanded, krate, macro_resolver)?

crates/hir_expand/src/hygiene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Hygiene {
3333
MacroDefKind::BuiltIn(_) => (None, false),
3434
MacroDefKind::BuiltInDerive(_) => (None, false),
3535
MacroDefKind::BuiltInEager(_) => (None, false),
36-
MacroDefKind::CustomDerive(_) => (None, false),
36+
MacroDefKind::ProcMacro(_) => (None, false),
3737
}
3838
}
3939
MacroCallId::EagerMacro(_id) => (None, false),

crates/hir_expand/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub enum MacroDefKind {
246246
// FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander
247247
BuiltInDerive(BuiltinDeriveExpander),
248248
BuiltInEager(EagerExpander),
249-
CustomDerive(ProcMacroExpander),
249+
ProcMacro(ProcMacroExpander),
250250
}
251251

252252
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

0 commit comments

Comments
 (0)