about summary refs log tree commit diff
path: root/library/std/src/path.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-04 07:54:33 +0200
committerGitHub <noreply@github.com>2025-06-04 07:54:33 +0200
commit88620b400e0dceb982af11f2309516ef088cbffa (patch)
tree58069d5ac7b9105d1761564c41b0993482b6fa4a /library/std/src/path.rs
parent59bdb5c3cfa4e746cc7e086073a9f5f9d1d87f75 (diff)
parentfab206bf5852c532f85b9ad30f9eea8fc952e8e1 (diff)
downloadrust-88620b400e0dceb982af11f2309516ef088cbffa.tar.gz
rust-88620b400e0dceb982af11f2309516ef088cbffa.zip
Rollup merge of #141467 - cyrgani:const-empty-stringlikes, r=Amanieu
make `OsString::new` and `PathBuf::new` unstably const

Since #129041, `String::into_bytes` is `const`, which allows making `OsString::new` and `PathBuf::new` unstably const now.
Not sure what the exact process for this is; does it need an ACP?
Diffstat (limited to 'library/std/src/path.rs')
-rw-r--r--library/std/src/path.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 050c617f564..014b56d28f4 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1191,7 +1191,8 @@ impl PathBuf {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]
     #[inline]
-    pub fn new() -> PathBuf {
+    #[rustc_const_unstable(feature = "const_pathbuf_osstring_new", issue = "141520")]
+    pub const fn new() -> PathBuf {
         PathBuf { inner: OsString::new() }
     }