@@ -251,13 +251,12 @@ pub struct FromBytesWithNulError {
251
251
/// # Examples
252
252
///
253
253
/// ```
254
- /// #![feature(cstring_from_vec_with_nul)]
255
254
/// use std::ffi::{CString, FromVecWithNulError};
256
255
///
257
256
/// let _: FromVecWithNulError = CString::from_vec_with_nul(b"f\0oo".to_vec()).unwrap_err();
258
257
/// ```
259
258
#[ derive( Clone , PartialEq , Eq , Debug ) ]
260
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
259
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
261
260
pub struct FromVecWithNulError {
262
261
error_kind : FromBytesWithNulErrorKind ,
263
262
bytes : Vec < u8 > ,
@@ -278,7 +277,7 @@ impl FromBytesWithNulError {
278
277
}
279
278
}
280
279
281
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
280
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
282
281
impl FromVecWithNulError {
283
282
/// Returns a slice of [`u8`]s bytes that were attempted to convert to a [`CString`].
284
283
///
@@ -287,7 +286,6 @@ impl FromVecWithNulError {
287
286
/// Basic usage:
288
287
///
289
288
/// ```
290
- /// #![feature(cstring_from_vec_with_nul)]
291
289
/// use std::ffi::CString;
292
290
///
293
291
/// // Some invalid bytes in a vector
@@ -298,6 +296,7 @@ impl FromVecWithNulError {
298
296
/// assert_eq!(&bytes[..], value.unwrap_err().as_bytes());
299
297
/// ```
300
298
#[ must_use]
299
+ #[ stable( feature = "cstring_from_vec_with_nul" , since = "1.58.0" ) ]
301
300
pub fn as_bytes ( & self ) -> & [ u8 ] {
302
301
& self . bytes [ ..]
303
302
}
@@ -313,7 +312,6 @@ impl FromVecWithNulError {
313
312
/// Basic usage:
314
313
///
315
314
/// ```
316
- /// #![feature(cstring_from_vec_with_nul)]
317
315
/// use std::ffi::CString;
318
316
///
319
317
/// // Some invalid bytes in a vector
@@ -324,6 +322,7 @@ impl FromVecWithNulError {
324
322
/// assert_eq!(bytes, value.unwrap_err().into_bytes());
325
323
/// ```
326
324
#[ must_use = "`self` will be dropped if the result is not used" ]
325
+ #[ stable( feature = "cstring_from_vec_with_nul" , since = "1.58.0" ) ]
327
326
pub fn into_bytes ( self ) -> Vec < u8 > {
328
327
self . bytes
329
328
}
@@ -704,15 +703,14 @@ impl CString {
704
703
/// # Example
705
704
///
706
705
/// ```
707
- /// #![feature(cstring_from_vec_with_nul)]
708
706
/// use std::ffi::CString;
709
707
/// assert_eq!(
710
708
/// unsafe { CString::from_vec_with_nul_unchecked(b"abc\0".to_vec()) },
711
709
/// unsafe { CString::from_vec_unchecked(b"abc".to_vec()) }
712
710
/// );
713
711
/// ```
714
712
#[ must_use]
715
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
713
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
716
714
pub unsafe fn from_vec_with_nul_unchecked ( v : Vec < u8 > ) -> Self {
717
715
Self { inner : v. into_boxed_slice ( ) }
718
716
}
@@ -733,7 +731,6 @@ impl CString {
733
731
/// when called without the ending nul byte.
734
732
///
735
733
/// ```
736
- /// #![feature(cstring_from_vec_with_nul)]
737
734
/// use std::ffi::CString;
738
735
/// assert_eq!(
739
736
/// CString::from_vec_with_nul(b"abc\0".to_vec())
@@ -745,14 +742,13 @@ impl CString {
745
742
/// An incorrectly formatted [`Vec`] will produce an error.
746
743
///
747
744
/// ```
748
- /// #![feature(cstring_from_vec_with_nul)]
749
745
/// use std::ffi::{CString, FromVecWithNulError};
750
746
/// // Interior nul byte
751
747
/// let _: FromVecWithNulError = CString::from_vec_with_nul(b"a\0bc".to_vec()).unwrap_err();
752
748
/// // No nul byte
753
749
/// let _: FromVecWithNulError = CString::from_vec_with_nul(b"abc".to_vec()).unwrap_err();
754
750
/// ```
755
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
751
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
756
752
pub fn from_vec_with_nul ( v : Vec < u8 > ) -> Result < Self , FromVecWithNulError > {
757
753
let nul_pos = memchr:: memchr ( 0 , & v) ;
758
754
match nul_pos {
@@ -1084,10 +1080,10 @@ impl fmt::Display for FromBytesWithNulError {
1084
1080
}
1085
1081
}
1086
1082
1087
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
1083
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
1088
1084
impl Error for FromVecWithNulError { }
1089
1085
1090
- #[ unstable ( feature = "cstring_from_vec_with_nul" , issue = "73179 " ) ]
1086
+ #[ stable ( feature = "cstring_from_vec_with_nul" , since = "1.58.0 " ) ]
1091
1087
impl fmt:: Display for FromVecWithNulError {
1092
1088
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1093
1089
match self . error_kind {
0 commit comments