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 {
137
137
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
138
138
#[ must_use]
139
139
#[ inline]
140
- pub fn new ( ) -> OsString {
140
+ #[ rustc_const_unstable( feature = "const_pathbuf_osstring_new" , issue = "141520" ) ]
141
+ pub const fn new ( ) -> OsString {
141
142
OsString { inner : Buf :: from_string ( String :: new ( ) ) }
142
143
}
143
144
Original file line number Diff line number Diff line change @@ -1191,7 +1191,8 @@ impl PathBuf {
1191
1191
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1192
1192
#[ must_use]
1193
1193
#[ inline]
1194
- pub fn new ( ) -> PathBuf {
1194
+ #[ rustc_const_unstable( feature = "const_pathbuf_osstring_new" , issue = "141520" ) ]
1195
+ pub const fn new ( ) -> PathBuf {
1195
1196
PathBuf { inner : OsString :: new ( ) }
1196
1197
}
1197
1198
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ impl Buf {
115
115
}
116
116
117
117
#[ inline]
118
- pub fn from_string ( s : String ) -> Buf {
118
+ pub const fn from_string ( s : String ) -> Buf {
119
119
Buf { inner : s. into_bytes ( ) }
120
120
}
121
121
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl Buf {
92
92
}
93
93
94
94
#[ inline]
95
- pub fn from_string ( s : String ) -> Buf {
95
+ pub const fn from_string ( s : String ) -> Buf {
96
96
Buf { inner : Wtf8Buf :: from_string ( s) }
97
97
}
98
98
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ impl Wtf8Buf {
209
209
///
210
210
/// Since WTF-8 is a superset of UTF-8, this always succeeds.
211
211
#[ inline]
212
- pub fn from_string ( string : String ) -> Wtf8Buf {
212
+ pub const fn from_string ( string : String ) -> Wtf8Buf {
213
213
Wtf8Buf { bytes : string. into_bytes ( ) , is_known_utf8 : true }
214
214
}
215
215
You can’t perform that action at this time.
0 commit comments