about summary refs log tree commit diff
path: root/library/std/src/path.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-03 13:46:47 +0000
committerbors <bors@rust-lang.org>2024-11-03 13:46:47 +0000
commit7028d9318fadc20e5e3058d52e44d785d31a6aaa (patch)
tree8d686b8ea589aca659c750e8ff8a5f9f7127d561 /library/std/src/path.rs
parent59ae5eba7e74d2cc7d8d611662e8b3a642d7093a (diff)
parent1ba782ab3d1ee6deed44ae9c005632cd1b3673ea (diff)
downloadrust-7028d9318fadc20e5e3058d52e44d785d31a6aaa.tar.gz
rust-7028d9318fadc20e5e3058d52e44d785d31a6aaa.zip
Auto merge of #132555 - matthiaskrgr:rollup-2d79661, r=matthiaskrgr
Rollup of 15 pull requests

Successful merges:

 - #129329 (Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`)
 - #131377 (Add LowerExp and UpperExp implementations to NonZero)
 - #132393 (Docs: added brief colon explanation)
 - #132437 (coverage: Regression test for inlining into an uninstrumented crate)
 - #132499 (unicode_data.rs: show command for generating file)
 - #132503 (better test for const HashMap; remove const_hash leftovers)
 - #132511 (stabilize const_arguments_as_str)
 - #132520 (NFC add known bug nr to test)
 - #132522 (make codegen help output more consistent)
 - #132523 (Added regression test for generics index out of bounds)
 - #132528 (Use `*_opt` typeck results fns to not ICE in fallback suggestion)
 - #132537 (PassWrapper: adapt for llvm/llvm-project@5445edb5d)
 - #132540 (Do not format generic consts)
 - #132543 (add and update some crashtests)
 - #132550 (compiler: Continue introducing rustc_abi to the compiler)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/path.rs')
-rw-r--r--library/std/src/path.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 62125f885b2..5662a44d832 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1762,6 +1762,16 @@ impl From<&Path> for Box<Path> {
     }
 }
 
+#[stable(feature = "box_from_mut_slice", since = "CURRENT_RUSTC_VERSION")]
+impl From<&mut Path> for Box<Path> {
+    /// Creates a boxed [`Path`] from a reference.
+    ///
+    /// This will allocate and clone `path` to it.
+    fn from(path: &mut Path) -> Box<Path> {
+        Self::from(&*path)
+    }
+}
+
 #[stable(feature = "box_from_cow", since = "1.45.0")]
 impl From<Cow<'_, Path>> for Box<Path> {
     /// Creates a boxed [`Path`] from a clone-on-write pointer.
@@ -1990,6 +2000,15 @@ impl From<&Path> for Arc<Path> {
     }
 }
 
+#[stable(feature = "shared_from_mut_slice", since = "CURRENT_RUSTC_VERSION")]
+impl From<&mut Path> for Arc<Path> {
+    /// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer.
+    #[inline]
+    fn from(s: &mut Path) -> Arc<Path> {
+        Arc::from(&*s)
+    }
+}
+
 #[stable(feature = "shared_from_slice2", since = "1.24.0")]
 impl From<PathBuf> for Rc<Path> {
     /// Converts a [`PathBuf`] into an <code>[Rc]<[Path]></code> by moving the [`PathBuf`] data into
@@ -2011,6 +2030,15 @@ impl From<&Path> for Rc<Path> {
     }
 }
 
+#[stable(feature = "shared_from_mut_slice", since = "CURRENT_RUSTC_VERSION")]
+impl From<&mut Path> for Rc<Path> {
+    /// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new [`Rc`] buffer.
+    #[inline]
+    fn from(s: &mut Path) -> Rc<Path> {
+        Rc::from(&*s)
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl ToOwned for Path {
     type Owned = PathBuf;