Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/macro_expansion_tests/mod.rs')
-rw-r--r--crates/hir-def/src/macro_expansion_tests/mod.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mod.rs b/crates/hir-def/src/macro_expansion_tests/mod.rs
index dc4334ee08..1c69b37f16 100644
--- a/crates/hir-def/src/macro_expansion_tests/mod.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mod.rs
@@ -14,7 +14,7 @@ mod builtin_fn_macro;
mod mbe;
mod proc_macros;
-use std::{iter, ops::Range, sync};
+use std::{any::TypeId, iter, ops::Range, sync};
use base_db::RootQueryDb;
use expect_test::Expect;
@@ -302,14 +302,15 @@ fn pretty_print_macro_expansion(
(_, T!['{']) => " ",
(T![;] | T!['{'] | T!['}'], _) => "\n",
(_, T!['}']) => "\n",
- (IDENT | LIFETIME_IDENT, IDENT | LIFETIME_IDENT) => " ",
- _ if prev_kind.is_keyword(Edition::CURRENT)
- && curr_kind.is_keyword(Edition::CURRENT) =>
+ _ if (prev_kind.is_any_identifier()
+ || prev_kind == LIFETIME_IDENT
+ || prev_kind.is_literal())
+ && (curr_kind.is_any_identifier()
+ || curr_kind == LIFETIME_IDENT
+ || curr_kind.is_literal()) =>
{
" "
}
- (IDENT, _) if curr_kind.is_keyword(Edition::CURRENT) => " ",
- (_, IDENT) if prev_kind.is_keyword(Edition::CURRENT) => " ",
(T![>], IDENT) => " ",
(T![>], _) if curr_kind.is_keyword(Edition::CURRENT) => " ",
(T![->], _) | (_, T![->]) => " ",
@@ -380,4 +381,8 @@ impl ProcMacroExpander for IdentityWhenValidProcMacroExpander {
panic!("got invalid macro input: {:?}", parse.errors());
}
}
+
+ fn eq_dyn(&self, other: &dyn ProcMacroExpander) -> bool {
+ other.type_id() == TypeId::of::<Self>()
+ }
}