Skip to content

Commit 34f7b53

Browse files
Merge #6874
6874: Implement `module_path!()` r=jonas-schievink a=jonas-schievink Closes #6747 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
2 parents 817fbeb + 81820fe commit 34f7b53

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

crates/hir_expand/src/builtin_macro.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ register_builtin! {
8888
(column, Column) => column_expand,
8989
(file, File) => file_expand,
9090
(line, Line) => line_expand,
91+
(module_path, ModulePath) => module_path_expand,
9192
(assert, Assert) => assert_expand,
9293
(stringify, Stringify) => stringify_expand,
9394
(format_args, FormatArgs) => format_args_expand,
@@ -105,6 +106,15 @@ register_builtin! {
105106
(option_env, OptionEnv) => option_env_expand
106107
}
107108

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+
108118
fn line_expand(
109119
_db: &dyn AstDatabase,
110120
_id: LazyMacroId,

crates/hir_expand/src/name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ pub mod known {
188188
column,
189189
compile_error,
190190
line,
191+
module_path,
191192
assert,
192193
stringify,
193194
concat,

0 commit comments

Comments
 (0)