Skip to content

Commit ebc6d6e

Browse files
committed
Rollup merge of #48507 - GuillaumeGomez:cstr-note, r=steveklabnik
Add new warning for CStr::from_ptr Fixes #48401.
2 parents ee94252 + 5344b07 commit ebc6d6e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libstd/ffi/c_str.rs

+2
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ impl CStr {
875875
/// `ptr`.
876876
/// * There is no guarantee that the memory pointed to by `ptr` contains a
877877
/// valid nul terminator byte at the end of the string.
878+
/// * It is not guaranteed that the memory pointed by `ptr` won't change
879+
/// before the `CStr` has been destroyed.
878880
///
879881
/// > **Note**: This operation is intended to be a 0-cost cast but it is
880882
/// > currently implemented with an up-front calculation of the length of

0 commit comments

Comments
 (0)