Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/builtin/fn_macro.rs')
-rw-r--r--crates/hir-expand/src/builtin/fn_macro.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir-expand/src/builtin/fn_macro.rs b/crates/hir-expand/src/builtin/fn_macro.rs
index eb7175c686..9181ad88b6 100644
--- a/crates/hir-expand/src/builtin/fn_macro.rs
+++ b/crates/hir-expand/src/builtin/fn_macro.rs
@@ -137,6 +137,7 @@ register_builtin! {
(const_format_args, ConstFormatArgs) => format_args_expand,
(format_args_nl, FormatArgsNl) => format_args_nl_expand,
(quote, Quote) => quote_expand,
+ (pattern_type, PatternType) => pattern_type_expand,
EagerExpander:
(compile_error, CompileError) => compile_error_expand,
@@ -994,3 +995,15 @@ fn unescape_str(s: &str) -> Cow<'_, str> {
Cow::Borrowed(s)
}
}
+
+fn pattern_type_expand(
+ _db: &dyn ExpandDatabase,
+ _arg_id: MacroCallId,
+ tt: &tt::TopSubtree,
+ call_site: Span,
+) -> ExpandResult<tt::TopSubtree> {
+ let mut tt = tt.clone();
+ tt.set_top_subtree_delimiter_kind(tt::DelimiterKind::Invisible);
+ let pound = mk_pound(call_site);
+ ExpandResult::ok(quote! {call_site => builtin #pound pattern_type ( #tt ) })
+}