Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/paths/src/lib.rs')
-rw-r--r--crates/paths/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs
index db705a7b69..a63d251c20 100644
--- a/crates/paths/src/lib.rs
+++ b/crates/paths/src/lib.rs
@@ -305,6 +305,11 @@ impl RelPath {
pub fn new_unchecked(path: &Path) -> &RelPath {
unsafe { &*(path as *const Path as *const RelPath) }
}
+
+ /// Equivalent of [`Path::to_path_buf`] for `RelPath`.
+ pub fn to_path_buf(&self) -> RelPathBuf {
+ RelPathBuf::try_from(self.0.to_path_buf()).unwrap()
+ }
}
/// Taken from <https://github.com/rust-lang/cargo/blob/79c769c3d7b4c2cf6a93781575b7f592ef974255/src/cargo/util/paths.rs#L60-L85>