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.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mod.rs b/crates/hir-def/src/macro_expansion_tests/mod.rs
index a2d0ba3deb..d0678a4065 100644
--- a/crates/hir-def/src/macro_expansion_tests/mod.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mod.rs
@@ -16,7 +16,7 @@ mod proc_macros;
use std::{iter, ops::Range, sync};
-use base_db::SourceDatabase;
+use base_db::RootQueryDb;
use expect_test::Expect;
use hir_expand::{
db::ExpandDatabase,
@@ -26,6 +26,7 @@ use hir_expand::{
};
use intern::Symbol;
use itertools::Itertools;
+use salsa::AsDynDatabase;
use span::{Edition, Span};
use stdx::{format_to, format_to_acc};
use syntax::{
@@ -63,9 +64,13 @@ fn check_errors(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect)
MacroCallKind::Derive { ast_id, .. } => ast_id.map(|it| it.erase()),
MacroCallKind::Attr { ast_id, .. } => ast_id.map(|it| it.erase()),
};
- let ast = db
- .parse(ast_id.file_id.file_id().expect("macros inside macros are not supported"))
- .syntax_node();
+
+ let editioned_file_id =
+ ast_id.file_id.file_id().expect("macros inside macros are not supported");
+ let editioned_file_id =
+ base_db::EditionedFileId::new(db.as_dyn_database(), editioned_file_id);
+
+ let ast = db.parse(editioned_file_id).syntax_node();
let ast_id_map = db.ast_id_map(ast_id.file_id);
let node = ast_id_map.get_erased(ast_id.value).to_node(&ast);
Some((node.text_range(), errors))