Skip to content

Commit e7ec9f7

Browse files
authored
Rollup merge of rust-lang#145209 - hanna-kruppe:path_add_extension, r=tgross35
Stabilize `path_add_extension` FCP in tracking issue rust-lang#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#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm. Closes rust-lang#127292 [0]: rust-lang#127292 (comment)
2 parents 1d7d788 + 52063ae commit e7ec9f7

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

library/std/src/path.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,8 +1575,6 @@ impl PathBuf {
15751575
/// # Examples
15761576
///
15771577
/// ```
1578-
/// #![feature(path_add_extension)]
1579-
///
15801578
/// use std::path::{Path, PathBuf};
15811579
///
15821580
/// let mut p = PathBuf::from("/feel/the");
@@ -1596,7 +1594,7 @@ impl PathBuf {
15961594
/// p.add_extension("");
15971595
/// assert_eq!(Path::new("/feel/the.formatted.dark"), p.as_path());
15981596
/// ```
1599-
#[unstable(feature = "path_add_extension", issue = "127292")]
1597+
#[stable(feature = "path_add_extension", since = "CURRENT_RUSTC_VERSION")]
16001598
pub fn add_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool {
16011599
self._add_extension(extension.as_ref())
16021600
}
@@ -2878,8 +2876,6 @@ impl Path {
28782876
/// # Examples
28792877
///
28802878
/// ```
2881-
/// #![feature(path_add_extension)]
2882-
///
28832879
/// use std::path::{Path, PathBuf};
28842880
///
28852881
/// let path = Path::new("foo.rs");
@@ -2890,7 +2886,7 @@ impl Path {
28902886
/// assert_eq!(path.with_added_extension("xz"), PathBuf::from("foo.tar.gz.xz"));
28912887
/// assert_eq!(path.with_added_extension("").with_added_extension("txt"), PathBuf::from("foo.tar.gz.txt"));
28922888
/// ```
2893-
#[unstable(feature = "path_add_extension", issue = "127292")]
2889+
#[stable(feature = "path_add_extension", since = "CURRENT_RUSTC_VERSION")]
28942890
pub fn with_added_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
28952891
let mut new_path = self.to_path_buf();
28962892
new_path.add_extension(extension);

library/std/tests/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(clone_to_uninit, path_add_extension, maybe_uninit_slice, normalize_lexically)]
1+
#![feature(clone_to_uninit, maybe_uninit_slice, normalize_lexically)]
22

33
use std::clone::CloneToUninit;
44
use std::ffi::OsStr;

0 commit comments

Comments
 (0)