aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src/builtin_macro.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-09 16:01:15 +0000
committerAleksey Kladov <[email protected]>2020-12-09 16:07:05 +0000
commit6e24321e4579d25686982002ed18f321db23cb9f (patch)
tree08f0fd7d99ad22a3d1db782482b66548e99ba8b2 /crates/hir_expand/src/builtin_macro.rs
parent5e3891c2559de5a6540d69bc14ded281484479f9 (diff)
Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;` in a lossless cross-platform & network-transparent way.
Diffstat (limited to 'crates/hir_expand/src/builtin_macro.rs')
-rw-r--r--crates/hir_expand/src/builtin_macro.rs5
1 files changed, 3 insertions, 2 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