about summary refs log tree commit diff
path: root/library/std/src/path.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-04 10:01:52 +1000
committerGitHub <noreply@github.com>2025-09-04 10:01:52 +1000
commit98f6887f359e791b430fb69b7ed68460343167b9 (patch)
tree95c2458510c86b046fb0017c5d81510c3ab2e8e8 /library/std/src/path.rs
parent732802c20745679757cd4a6191963acd821033a1 (diff)
parent52063ae24860bb5cb3abc6f3dd83904bc18a3b0f (diff)
downloadrust-98f6887f359e791b430fb69b7ed68460343167b9.tar.gz
rust-98f6887f359e791b430fb69b7ed68460343167b9.zip
Rollup merge of #145209 - hanna-kruppe:path_add_extension, r=tgross35
Stabilize `path_add_extension`

FCP in tracking issue rust-lang/rust#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang/rust#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang/rust#127292

[0]: https://github.com/rust-lang/rust/issues/127292#issuecomment-2605197960
Diffstat (limited to 'library/std/src/path.rs')
-rw-r--r--library/std/src/path.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 5ccea1c972c..531a1aa4215 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1575,8 +1575,6 @@ impl PathBuf {
     /// # Examples
     ///
     /// ```
-    /// #![feature(path_add_extension)]
-    ///
     /// use std::path::{Path, PathBuf};
     ///
     /// let mut p = PathBuf::from("/feel/the");
@@ -1596,7 +1594,7 @@ impl PathBuf {
     /// p.add_extension("");
     /// assert_eq!(Path::new("/feel/the.formatted.dark"), p.as_path());
     /// ```
-    #[unstable(feature = "path_add_extension", issue = "127292")]
+    #[stable(feature = "path_add_extension", since = "CURRENT_RUSTC_VERSION")]
     pub fn add_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool {
         self._add_extension(extension.as_ref())
     }
@@ -2880,8 +2878,6 @@ impl Path {
     /// # Examples
     ///
     /// ```
-    /// #![feature(path_add_extension)]
-    ///
     /// use std::path::{Path, PathBuf};
     ///
     /// let path = Path::new("foo.rs");
@@ -2892,7 +2888,7 @@ impl Path {
     /// assert_eq!(path.with_added_extension("xz"), PathBuf::from("foo.tar.gz.xz"));
     /// assert_eq!(path.with_added_extension("").with_added_extension("txt"), PathBuf::from("foo.tar.gz.txt"));
     /// ```
-    #[unstable(feature = "path_add_extension", issue = "127292")]
+    #[stable(feature = "path_add_extension", since = "CURRENT_RUSTC_VERSION")]
     pub fn with_added_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
         let mut new_path = self.to_path_buf();
         new_path.add_extension(extension);