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 {
457457 /// to a contiguous region of memory terminated with a 0 byte to represent
458458 /// the end of the string.
459459 ///
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+ ///
460464 /// **WARNING**
461465 ///
462466 /// The returned pointer is read-only; writing to it (including passing it
@@ -470,6 +474,7 @@ impl CStr {
470474 /// # #![allow(unused_must_use)] #![allow(temporary_cstring_as_ptr)]
471475 /// use std::ffi::CString;
472476 ///
477+ /// // Do not do this:
473478 /// let ptr = CString::new("Hello").expect("CString::new failed").as_ptr();
474479 /// unsafe {
475480 /// // `ptr` is dangling
You can’t perform that action at this time.
0 commit comments