diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-14 15:39:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-14 15:39:31 +0000 |
commit | 34f7b5383af61d8896c97e407888cfde2ba35350 (patch) | |
tree | 212f21083b89a68897cb8f75da0bfb8bea21b6ee /crates/hir_expand/src | |
parent | 817fbebbb5f9187994b1a09a603ba9c7b2755a06 (diff) | |
parent | 81820fe52cde8e2433eb140441375e408e2659ee (diff) |
Merge #6874
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 <[email protected]>
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r-- | crates/hir_expand/src/builtin_macro.rs | 10 | ||||
-rw-r--r-- | crates/hir_expand/src/name.rs | 1 |
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 | ||
109 | fn 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 | |||
108 | fn line_expand( | 118 | fn 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, |