Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests.rs')
-rw-r--r--crates/hir_def/src/macro_expansion_tests.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests.rs b/crates/hir_def/src/macro_expansion_tests.rs
index 5f8bf44cc9..036d9147a0 100644
--- a/crates/hir_def/src/macro_expansion_tests.rs
+++ b/crates/hir_def/src/macro_expansion_tests.rs
@@ -12,6 +12,7 @@
mod mbe;
mod builtin_fn_macro;
mod builtin_derive_macro;
+mod proc_macros;
use std::{iter, ops::Range};
@@ -28,7 +29,7 @@ use syntax::{
use crate::{
db::DefDatabase, nameres::ModuleSource, resolver::HasResolver, src::HasSource, test_db::TestDB,
- AsMacroCall, Lookup,
+ AdtId, AsMacroCall, Lookup, ModuleDefId,
};
#[track_caller]
@@ -124,6 +125,16 @@ fn check(ra_fixture: &str, mut expect: Expect) {
expanded_text.replace_range(range, &expn_text)
}
+ for decl_id in def_map[local_id].scope.declarations() {
+ if let ModuleDefId::AdtId(AdtId::StructId(struct_id)) = decl_id {
+ let src = struct_id.lookup(&db).source(&db);
+ if src.file_id.is_attr_macro(&db) || src.file_id.is_custom_derive(&db) {
+ let pp = pretty_print_macro_expansion(src.value.syntax().clone());
+ format_to!(expanded_text, "\n{}", pp)
+ }
+ }
+ }
+
for impl_id in def_map[local_id].scope.impls() {
let src = impl_id.lookup(&db).source(&db);
if src.file_id.is_builtin_derive(&db).is_some() {