aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_expand')
-rw-r--r--crates/hir_expand/src/builtin_macro.rs5
-rw-r--r--crates/hir_expand/src/test_db.rs6
2 files changed, 6 insertions, 5 deletions
diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs
index 79b970850..f60666a54 100644
--- a/crates/hir_expand/src/builtin_macro.rs
+++ b/crates/hir_expand/src/builtin_macro.rs
@@ -4,7 +4,7 @@ use crate::{
4 MacroDefId, MacroDefKind, TextSize, 4 MacroDefId, MacroDefKind, TextSize,
5}; 5};
6 6
7use base_db::FileId; 7use base_db::{AnchoredPath, FileId};
8use either::Either; 8use either::Either;
9use mbe::{parse_to_token_tree, ExpandResult}; 9use mbe::{parse_to_token_tree, ExpandResult};
10use parser::FragmentKind; 10use parser::FragmentKind;
@@ -324,7 +324,8 @@ fn relative_file(
324 allow_recursion: bool, 324 allow_recursion: bool,
325) -> Option<FileId> { 325) -> Option<FileId> {
326 let call_site = call_id.as_file().original_file(db); 326 let call_site = call_id.as_file().original_file(db);
327 let res = db.resolve_path(call_site, path)?; 327 let path = AnchoredPath { anchor: call_site, path };
328 let res = db.resolve_path(path)?;
328 // Prevent include itself 329 // Prevent include itself
329 if res == call_site && !allow_recursion { 330 if res == call_site && !allow_recursion {
330 None 331 None
diff --git a/crates/hir_expand/src/test_db.rs b/crates/hir_expand/src/test_db.rs
index fca501e1f..7168a9462 100644
--- a/crates/hir_expand/src/test_db.rs
+++ b/crates/hir_expand/src/test_db.rs
@@ -5,7 +5,7 @@ use std::{
5 sync::{Arc, Mutex}, 5 sync::{Arc, Mutex},
6}; 6};
7 7
8use base_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate}; 8use base_db::{salsa, AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate};
9use rustc_hash::FxHashSet; 9use rustc_hash::FxHashSet;
10 10
11#[salsa::database( 11#[salsa::database(
@@ -40,8 +40,8 @@ impl FileLoader for TestDB {
40 fn file_text(&self, file_id: FileId) -> Arc<String> { 40 fn file_text(&self, file_id: FileId) -> Arc<String> {
41 FileLoaderDelegate(self).file_text(file_id) 41 FileLoaderDelegate(self).file_text(file_id)
42 } 42 }
43 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { 43 fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> {
44 FileLoaderDelegate(self).resolve_path(anchor, path) 44 FileLoaderDelegate(self).resolve_path(path)
45 } 45 }
46 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> { 46 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
47 FileLoaderDelegate(self).relevant_crates(file_id) 47 FileLoaderDelegate(self).relevant_crates(file_id)