6874: Implement `module_path!()` r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/6747

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
bors[bot] 2020-12-14 15:39:31 +00:00 committed by GitHub
commit 34f7b5383a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -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<tt::Subtree> {
// Just return a dummy result.
ExpandResult::ok(quote! { "module::path" })
}
fn line_expand(
_db: &dyn AstDatabase,
_id: LazyMacroId,

View file

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