File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
branches/stable/src/libstd/ffi Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: a70ae2ffb9a5dd08d916b9938eeca820486ba7a0
32
+ refs/heads/stable: 16f218b6006faa752925ca5934372c34f1eb2953
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
35
35
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Original file line number Diff line number Diff line change @@ -449,16 +449,16 @@ impl CStr {
449
449
/// use std::ffi::CStr;
450
450
///
451
451
/// # fn main() {
452
- /// let cstr = CStr::from_bytes (b"hello\0");
452
+ /// let cstr = CStr::from_bytes_with_nul (b"hello\0");
453
453
/// assert!(cstr.is_some());
454
454
/// # }
455
455
/// ```
456
456
#[ unstable( feature = "cstr_from_bytes" , reason = "recently added" , issue = "0" ) ]
457
- pub fn from_bytes < ' a > ( bytes : & ' a [ u8 ] ) -> Option < & ' a CStr > {
457
+ pub fn from_bytes_with_nul < ' a > ( bytes : & ' a [ u8 ] ) -> Option < & ' a CStr > {
458
458
if bytes. is_empty ( ) || memchr:: memchr ( 0 , & bytes) != Some ( bytes. len ( ) - 1 ) {
459
459
None
460
460
} else {
461
- Some ( unsafe { Self :: from_bytes_unchecked ( bytes) } )
461
+ Some ( unsafe { Self :: from_bytes_with_nul_unchecked ( bytes) } )
462
462
}
463
463
}
464
464
@@ -477,13 +477,13 @@ impl CStr {
477
477
/// # fn main() {
478
478
/// unsafe {
479
479
/// let cstring = CString::new("hello").unwrap();
480
- /// let cstr = CStr::from_bytes_unchecked (cstring.to_bytes_with_nul());
480
+ /// let cstr = CStr::from_bytes_with_nul_unchecked (cstring.to_bytes_with_nul());
481
481
/// assert_eq!(cstr, &*cstring);
482
482
/// }
483
483
/// # }
484
484
/// ```
485
485
#[ unstable( feature = "cstr_from_bytes" , reason = "recently added" , issue = "0" ) ]
486
- pub unsafe fn from_bytes_unchecked < ' a > ( bytes : & ' a [ u8 ] ) -> & ' a CStr {
486
+ pub unsafe fn from_bytes_with_nul_unchecked < ' a > ( bytes : & ' a [ u8 ] ) -> & ' a CStr {
487
487
mem:: transmute ( bytes)
488
488
}
489
489
You can’t perform that action at this time.
0 commit comments