From 81820fe52cde8e2433eb140441375e408e2659ee Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 14 Dec 2020 16:38:53 +0100 Subject: Implement `module_path!()` --- crates/hir_expand/src/builtin_macro.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/hir_expand/src/builtin_macro.rs') diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 477192a09..8db8c7d0c 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs @@ -88,6 +88,7 @@ register_builtin! { (column, Column) => column_expand, (file, File) => file_expand, (line, Line) => line_expand, + (module_path, ModulePath) => module_path_expand, (assert, Assert) => assert_expand, (stringify, Stringify) => stringify_expand, (format_args, FormatArgs) => format_args_expand, @@ -105,6 +106,15 @@ register_builtin! { (option_env, OptionEnv) => option_env_expand } +fn module_path_expand( + _db: &dyn AstDatabase, + _id: LazyMacroId, + _tt: &tt::Subtree, +) -> ExpandResult { + // Just return a dummy result. + ExpandResult::ok(quote! { "module::path" }) +} + fn line_expand( _db: &dyn AstDatabase, _id: LazyMacroId, -- cgit v1.2.3