From 6e24321e4579d25686982002ed18f321db23cb9f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 9 Dec 2020 19:01:15 +0300 Subject: Introduce anchored_path They allow to represent paths like `#[path = "C:\path.rs"] mod foo;` in a lossless cross-platform & network-transparent way. --- crates/ide/src/diagnostics/fixes.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ide/src/diagnostics') diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index 24d08651e..29c7a040b 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs @@ -8,7 +8,7 @@ use hir::{ }, HasSource, HirDisplay, Semantics, VariantDef, }; -use ide_db::base_db::FileId; +use ide_db::base_db::{AnchoredPathBuf, FileId}; use ide_db::{ source_change::{FileSystemEdit, SourceFileEdit}, RootDatabase, @@ -36,8 +36,10 @@ impl DiagnosticWithFix for UnresolvedModule { Some(Fix::new( "Create module", FileSystemEdit::CreateFile { - anchor: self.file.original_file(sema.db), - dst: self.candidate.clone(), + dst: AnchoredPathBuf { + anchor: self.file.original_file(sema.db), + path: self.candidate.clone(), + }, } .into(), unresolved_module.syntax().text_range(), -- cgit v1.2.3