We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af3c8b2 commit fd89470Copy full SHA for fd89470
library/core/src/ffi/c_str.rs
@@ -457,6 +457,10 @@ impl CStr {
457
/// to a contiguous region of memory terminated with a 0 byte to represent
458
/// the end of the string.
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
+ ///
464
/// **WARNING**
465
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();
479
/// unsafe {
480
/// // `ptr` is dangling
0 commit comments