Implement module_path!()

This commit is contained in:
Jonas Schievink 2020-12-14 16:38:53 +01:00
parent 134c7563be
commit 81820fe52c
2 changed files with 11 additions and 0 deletions

View file

@ -88,6 +88,7 @@ register_builtin! {
(column, Column) => column_expand, (column, Column) => column_expand,
(file, File) => file_expand, (file, File) => file_expand,
(line, Line) => line_expand, (line, Line) => line_expand,
(module_path, ModulePath) => module_path_expand,
(assert, Assert) => assert_expand, (assert, Assert) => assert_expand,
(stringify, Stringify) => stringify_expand, (stringify, Stringify) => stringify_expand,
(format_args, FormatArgs) => format_args_expand, (format_args, FormatArgs) => format_args_expand,
@ -105,6 +106,15 @@ register_builtin! {
(option_env, OptionEnv) => option_env_expand (option_env, OptionEnv) => option_env_expand
} }
fn module_path_expand(
_db: &dyn AstDatabase,
_id: LazyMacroId,
_tt: &tt::Subtree,
) -> ExpandResult<tt::Subtree> {
// Just return a dummy result.
ExpandResult::ok(quote! { "module::path" })
}
fn line_expand( fn line_expand(
_db: &dyn AstDatabase, _db: &dyn AstDatabase,
_id: LazyMacroId, _id: LazyMacroId,

View file

@ -188,6 +188,7 @@ pub mod known {
column, column,
compile_error, compile_error,
line, line,
module_path,
assert, assert,
stringify, stringify,
concat, concat,