Rollup merge of #145464 - Kivooeo:stabilize-const_pathbuf_osstring_new, r=ibraheemdev

Stabilize `const_pathbuf_osstring_new` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/141520) and stabilises `{OsString, PathBuf}::new` in const
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-08-19 19:45:32 +08:00 committed by GitHub
commit 9a5c00a673
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -137,7 +137,7 @@ impl OsString {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
#[inline]
#[rustc_const_unstable(feature = "const_pathbuf_osstring_new", issue = "141520")]
#[rustc_const_stable(feature = "const_pathbuf_osstring_new", since = "CURRENT_RUSTC_VERSION")]
pub const fn new() -> OsString {
OsString { inner: Buf::from_string(String::new()) }
}

View file

@ -1191,7 +1191,7 @@ impl PathBuf {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
#[inline]
#[rustc_const_unstable(feature = "const_pathbuf_osstring_new", issue = "141520")]
#[rustc_const_stable(feature = "const_pathbuf_osstring_new", since = "CURRENT_RUSTC_VERSION")]
pub const fn new() -> PathBuf {
PathBuf { inner: OsString::new() }
}