From c15e742c2a15190dd2be88418801b189a1578859 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 17 Jun 2024 09:41:44 +0200 Subject: [PATCH] Don't use strings to represent paths --- frontend/exporter/src/types/copied.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/exporter/src/types/copied.rs b/frontend/exporter/src/types/copied.rs index 3ac0bc430..dce59c5c7 100644 --- a/frontend/exporter/src/types/copied.rs +++ b/frontend/exporter/src/types/copied.rs @@ -876,9 +876,9 @@ impl<'s, S: UnderOwnerState<'s>, T: SInto, U> SInto> } } -impl<'tcx, S: UnderOwnerState<'tcx>> SInto for PathBuf { - fn sinto(&self, _: &S) -> String { - self.as_path().display().to_string() +impl<'tcx, S> SInto for PathBuf { + fn sinto(&self, _: &S) -> PathBuf { + self.clone() } } @@ -888,14 +888,10 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto for PathBuf { )] #[args(, from: rustc_span::RealFileName, state: S as _s)] pub enum RealFileName { - LocalPath(#[map(x.to_str().unwrap().into())] String), - #[map(RealFileName::Remapped { - local_path: local_path.as_ref().map(|path| path.to_str().unwrap().into()), - virtual_name: virtual_name.to_str().unwrap().into() - })] + LocalPath(PathBuf), Remapped { - local_path: Option, - virtual_name: String, + local_path: Option, + virtual_name: PathBuf, }, }