about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-03-06 18:20:35 +0800
committerkennytm <kennytm@gmail.com>2018-03-06 20:52:36 +0800
commitebc6d6e24fa28cfaebd788786f61ab01a9ffda54 (patch)
tree27d76c1b6932a59943eba929b295653f5183b3d5 /src/libstd
parentee9425214bf6b71692c5d79b92ca4ec20fbdcd4a (diff)
parent5344b07addf342334470778964d863d99eec7430 (diff)
downloadrust-ebc6d6e24fa28cfaebd788786f61ab01a9ffda54.tar.gz
rust-ebc6d6e24fa28cfaebd788786f61ab01a9ffda54.zip
Rollup merge of #48507 - GuillaumeGomez:cstr-note, r=steveklabnik
Add new warning for CStr::from_ptr

Fixes #48401.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ffi/c_str.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index 2519d830435..c88c2bc9137 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -875,6 +875,8 @@ impl CStr {
     ///   `ptr`.
     /// * There is no guarantee that the memory pointed to by `ptr` contains a
     ///   valid nul terminator byte at the end of the string.
+    /// * It is not guaranteed that the memory pointed by `ptr` won't change
+    ///   before the `CStr` has been destroyed.
     ///
     /// > **Note**: This operation is intended to be a 0-cost cast but it is
     /// > currently implemented with an up-front calculation of the length of