about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-06-07 07:05:44 +0200
committerGitHub <noreply@github.com>2025-06-07 07:05:44 +0200
commit06a2daf4db450133510b2834f2483a68b026ef2c (patch)
treeeb0a020f86445ac65cb0f3e44b4e552371446888
parent775e0c8aeb8f63192854b27156f8b05a06b51814 (diff)
parenteba3a6106728e131286e3751459fccd7594102ef (diff)
downloadrust-06a2daf4db450133510b2834f2483a68b026ef2c.tar.gz
rust-06a2daf4db450133510b2834f2483a68b026ef2c.zip
Rollup merge of #137992 - its-the-shrimp:stabilise_os_string_pathbuf_leak, r=dtolnay
Stabilise `os_string_pathbuf_leak`

This PR stabilises `#[feature(os_string_pathbuf_leak)]`, which defines 2 new methods in the std:

```rs
impl OsString {
    pub fn leak<'a>(self) -> &'a mut OsStr;
}

impl PathBuf {
    pub fn leak<'a>(self) -> &'a mut Path;
}
```

ACP: https://github.com/rust-lang/libs-team/issues/389
Tracking issue: https://github.com/rust-lang/rust/issues/125965
Implementation: https://github.com/rust-lang/rust/pull/125966
-rw-r--r--library/std/src/ffi/os_str.rs2
-rw-r--r--library/std/src/path.rs2
-rw-r--r--library/std/tests/path.rs1
3 files changed, 2 insertions, 3 deletions
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs
index 21d5b7292e8..3cc225004ea 100644
--- a/library/std/src/ffi/os_str.rs
+++ b/library/std/src/ffi/os_str.rs
@@ -568,7 +568,7 @@ impl OsString {
     /// However, keep in mind that trimming the capacity may result in a reallocation and copy.
     ///
     /// [`into_boxed_os_str`]: Self::into_boxed_os_str
-    #[unstable(feature = "os_string_pathbuf_leak", issue = "125965")]
+    #[stable(feature = "os_string_pathbuf_leak", since = "CURRENT_RUSTC_VERSION")]
     #[inline]
     pub fn leak<'a>(self) -> &'a mut OsStr {
         OsStr::from_inner_mut(self.inner.leak())
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 014b56d28f4..826d9f0f39d 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1252,7 +1252,7 @@ impl PathBuf {
     /// However, keep in mind that trimming the capacity may result in a reallocation and copy.
     ///
     /// [`into_boxed_path`]: Self::into_boxed_path
-    #[unstable(feature = "os_string_pathbuf_leak", issue = "125965")]
+    #[stable(feature = "os_string_pathbuf_leak", since = "CURRENT_RUSTC_VERSION")]
     #[inline]
     pub fn leak<'a>(self) -> &'a mut Path {
         Path::from_inner_mut(self.inner.leak())
diff --git a/library/std/tests/path.rs b/library/std/tests/path.rs
index 781855a2d14..be0dda1d426 100644
--- a/library/std/tests/path.rs
+++ b/library/std/tests/path.rs
@@ -3,7 +3,6 @@
     path_add_extension,
     path_file_prefix,
     maybe_uninit_slice,
-    os_string_pathbuf_leak,
     normalize_lexically
 )]