Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/builtin/fn_macro.rs')
-rw-r--r--crates/hir-expand/src/builtin/fn_macro.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/crates/hir-expand/src/builtin/fn_macro.rs b/crates/hir-expand/src/builtin/fn_macro.rs
index e4d09ddb3a..795d9b14df 100644
--- a/crates/hir-expand/src/builtin/fn_macro.rs
+++ b/crates/hir-expand/src/builtin/fn_macro.rs
@@ -116,6 +116,7 @@ register_builtin! {
(column, Column) => line_expand,
(file, File) => file_expand,
(line, Line) => line_expand,
+ (module_path, ModulePath) => module_path_expand,
(assert, Assert) => assert_expand,
(stringify, Stringify) => stringify_expand,
(llvm_asm, LlvmAsm) => asm_expand,
@@ -141,10 +142,7 @@ register_builtin! {
(include_bytes, IncludeBytes) => include_bytes_expand,
(include_str, IncludeStr) => include_str_expand,
(env, Env) => env_expand,
- (option_env, OptionEnv) => option_env_expand,
- // This isn't really eager, we have no inputs, but we abuse the fact how eager macros are
- // handled in r-a to be able to thread the module path through.
- (module_path, ModulePath) => module_path_expand
+ (option_env, OptionEnv) => option_env_expand
}
fn mk_pound(span: Span) -> tt::Subtree {
@@ -159,6 +157,18 @@ fn mk_pound(span: Span) -> tt::Subtree {
)
}
+fn module_path_expand(
+ _db: &dyn ExpandDatabase,
+ _id: MacroCallId,
+ _tt: &tt::Subtree,
+ span: Span,
+) -> ExpandResult<tt::Subtree> {
+ // Just return a dummy result.
+ ExpandResult::ok(quote! {span =>
+ "module::path"
+ })
+}
+
fn line_expand(
_db: &dyn ExpandDatabase,
_id: MacroCallId,
@@ -894,18 +904,6 @@ fn option_env_expand(
ExpandResult::ok(expanded)
}
-fn module_path_expand(
- _db: &dyn ExpandDatabase,
- _id: MacroCallId,
- tt: &tt::Subtree,
- span: Span,
-) -> ExpandResult<tt::Subtree> {
- // Note: The actual implementation of this is in crates\hir-expand\src\eager.rs
- ExpandResult::ok(quote! {span =>
- #tt
- })
-}
-
fn quote_expand(
_db: &dyn ExpandDatabase,
_arg_id: MacroCallId,