File tree Expand file tree Collapse file tree 5 files changed +7
-5
lines changed Expand file tree Collapse file tree 5 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ impl OsString {
137137 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
138138 #[ must_use]
139139 #[ inline]
140- pub fn new ( ) -> OsString {
140+ #[ rustc_const_unstable( feature = "const_pathbuf_osstring_new" , issue = "141520" ) ]
141+ pub const fn new ( ) -> OsString {
141142 OsString { inner : Buf :: from_string ( String :: new ( ) ) }
142143 }
143144
Original file line number Diff line number Diff line change @@ -1191,7 +1191,8 @@ impl PathBuf {
11911191 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
11921192 #[ must_use]
11931193 #[ inline]
1194- pub fn new ( ) -> PathBuf {
1194+ #[ rustc_const_unstable( feature = "const_pathbuf_osstring_new" , issue = "141520" ) ]
1195+ pub const fn new ( ) -> PathBuf {
11951196 PathBuf { inner : OsString :: new ( ) }
11961197 }
11971198
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ impl Buf {
115115 }
116116
117117 #[ inline]
118- pub fn from_string ( s : String ) -> Buf {
118+ pub const fn from_string ( s : String ) -> Buf {
119119 Buf { inner : s. into_bytes ( ) }
120120 }
121121
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl Buf {
9292 }
9393
9494 #[ inline]
95- pub fn from_string ( s : String ) -> Buf {
95+ pub const fn from_string ( s : String ) -> Buf {
9696 Buf { inner : Wtf8Buf :: from_string ( s) }
9797 }
9898
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ impl Wtf8Buf {
209209 ///
210210 /// Since WTF-8 is a superset of UTF-8, this always succeeds.
211211 #[ inline]
212- pub fn from_string ( string : String ) -> Wtf8Buf {
212+ pub const fn from_string ( string : String ) -> Wtf8Buf {
213213 Wtf8Buf { bytes : string. into_bytes ( ) , is_known_utf8 : true }
214214 }
215215
You can’t perform that action at this time.
0 commit comments