File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,10 @@ impl CStr {
457
457
/// to a contiguous region of memory terminated with a 0 byte to represent
458
458
/// the end of the string.
459
459
///
460
+ /// The type of the returned pointer is
461
+ /// [`*const c_char`][crate::ffi::c_char], and whether it's
462
+ /// an alias for `*const i8` or `*const u8` is platform-specific.
463
+ ///
460
464
/// **WARNING**
461
465
///
462
466
/// The returned pointer is read-only; writing to it (including passing it
@@ -470,6 +474,7 @@ impl CStr {
470
474
/// # #![allow(unused_must_use)] #![allow(temporary_cstring_as_ptr)]
471
475
/// use std::ffi::CString;
472
476
///
477
+ /// // Do not do this:
473
478
/// let ptr = CString::new("Hello").expect("CString::new failed").as_ptr();
474
479
/// unsafe {
475
480
/// // `ptr` is dangling
You can’t perform that action at this time.
0 commit comments