diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index d551f91985..a0069682d0 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs @@ -9,7 +9,7 @@ use crate::{ use crate::quote; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum BuiltinExpander { +pub enum BuiltinFnLikeExpander { Column, File, Line, @@ -18,7 +18,7 @@ pub enum BuiltinExpander { struct BuiltInMacroInfo { name: name::Name, - kind: BuiltinExpander, + kind: BuiltinFnLikeExpander, expand: fn( db: &dyn AstDatabase, id: MacroCallId, @@ -29,7 +29,7 @@ struct BuiltInMacroInfo { macro_rules! register_builtin { ( $(($name:ident, $kind: ident) => $expand:ident),* ) => { const BUILTIN_MACROS: &[BuiltInMacroInfo] = &[ - $(BuiltInMacroInfo { name: name::$name, kind: BuiltinExpander::$kind, expand: $expand }),* + $(BuiltInMacroInfo { name: name::$name, kind: BuiltinFnLikeExpander::$kind, expand: $expand }),* ]; }; } @@ -41,7 +41,7 @@ register_builtin! { (STRINGIFY_MACRO, Stringify) => stringify_expand } -impl BuiltinExpander { +impl BuiltinFnLikeExpander { pub fn expand( &self, db: &dyn AstDatabase, @@ -195,7 +195,7 @@ mod tests { use crate::{test_db::TestDB, MacroCallLoc}; use ra_db::{fixture::WithFixture, SourceDatabase}; - fn expand_builtin_macro(s: &str, expander: BuiltinExpander) -> String { + fn expand_builtin_macro(s: &str, expander: BuiltinFnLikeExpander) -> String { let (db, file_id) = TestDB::with_single_file(&s); let parsed = db.parse(file_id); let macro_calls: Vec<_> = @@ -229,7 +229,7 @@ mod tests { macro_rules! column {() => {}} column!() "#, - BuiltinExpander::Column, + BuiltinFnLikeExpander::Column, ); assert_eq!(expanded, "9"); @@ -243,7 +243,7 @@ mod tests { macro_rules! line {() => {}} line!() "#, - BuiltinExpander::Line, + BuiltinFnLikeExpander::Line, ); assert_eq!(expanded, "4"); @@ -257,7 +257,7 @@ mod tests { macro_rules! stringify {() => {}} stringify!(a b c) "#, - BuiltinExpander::Stringify, + BuiltinFnLikeExpander::Stringify, ); assert_eq!(expanded, "\"a b c\""); @@ -271,7 +271,7 @@ mod tests { macro_rules! file {() => {}} file!() "#, - BuiltinExpander::File, + BuiltinFnLikeExpander::File, ); assert_eq!(expanded, "\"\""); diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index e1d93a8ef5..8e46fa177d 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs @@ -9,14 +9,14 @@ use ra_prof::profile; use ra_syntax::{AstNode, Parse, SyntaxNode}; use crate::{ - ast_id_map::AstIdMap, BuiltinExpander, HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc, - MacroDefId, MacroDefKind, MacroFile, MacroFileKind, + ast_id_map::AstIdMap, BuiltinFnLikeExpander, HirFileId, HirFileIdRepr, MacroCallId, + MacroCallLoc, MacroDefId, MacroDefKind, MacroFile, MacroFileKind, }; #[derive(Debug, Clone, Eq, PartialEq)] pub enum TokenExpander { MacroRules(mbe::MacroRules), - Builtin(BuiltinExpander), + Builtin(BuiltinFnLikeExpander), } impl TokenExpander { diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index f514a15e4e..4f3ccf1d0d 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -24,7 +24,7 @@ use ra_syntax::{ }; use crate::ast_id_map::FileAstId; -use crate::builtin_macro::BuiltinExpander; +use crate::builtin_macro::BuiltinFnLikeExpander; #[cfg(test)] mod test_db; @@ -138,7 +138,7 @@ pub struct MacroDefId { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum MacroDefKind { Declarative, - BuiltIn(BuiltinExpander), + BuiltIn(BuiltinFnLikeExpander), } #[derive(Debug, Clone, PartialEq, Eq, Hash)]