Revert "feat: Implement module_path macro"

This commit is contained in:
Lukas Wirth 2024-08-27 08:19:09 +02:00 committed by GitHub
parent 095926ea6f
commit fa48bc216c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 71 additions and 278 deletions

View file

@ -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,