aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-14 15:38:53 +0000
committerJonas Schievink <[email protected]>2020-12-14 15:38:53 +0000
commit81820fe52cde8e2433eb140441375e408e2659ee (patch)
treeadedd3b05a0c4f28694316184e9df77460c3da68 /crates/hir_expand/src
parent134c7563be05d120ffb45d9b971ba95735a0fcb5 (diff)
Implement `module_path!()`
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r--crates/hir_expand/src/builtin_macro.rs10
-rw-r--r--crates/hir_expand/src/name.rs1
2 files changed, 11 insertions, 0 deletions
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! {
88 (column, Column) => column_expand, 88 (column, Column) => column_expand,
89 (file, File) => file_expand, 89 (file, File) => file_expand,
90 (line, Line) => line_expand, 90 (line, Line) => line_expand,
91 (module_path, ModulePath) => module_path_expand,
91 (assert, Assert) => assert_expand, 92 (assert, Assert) => assert_expand,
92 (stringify, Stringify) => stringify_expand, 93 (stringify, Stringify) => stringify_expand,
93 (format_args, FormatArgs) => format_args_expand, 94 (format_args, FormatArgs) => format_args_expand,
@@ -105,6 +106,15 @@ register_builtin! {
105 (option_env, OptionEnv) => option_env_expand 106 (option_env, OptionEnv) => option_env_expand
106} 107}
107 108
109fn module_path_expand(
110 _db: &dyn AstDatabase,
111 _id: LazyMacroId,
112 _tt: &tt::Subtree,
113) -> ExpandResult<tt::Subtree> {
114 // Just return a dummy result.
115 ExpandResult::ok(quote! { "module::path" })
116}
117
108fn line_expand( 118fn line_expand(
109 _db: &dyn AstDatabase, 119 _db: &dyn AstDatabase,
110 _id: LazyMacroId, 120 _id: LazyMacroId,
diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs
index 583ed6142..6ec5ca0a9 100644
--- a/crates/hir_expand/src/name.rs
+++ b/crates/hir_expand/src/name.rs
@@ -188,6 +188,7 @@ pub mod known {
188 column, 188 column,
189 compile_error, 189 compile_error,
190 line, 190 line,
191 module_path,
191 assert, 192 assert,
192 stringify, 193 stringify,
193 concat, 194 concat,