Rollup merge of #48507 - GuillaumeGomez:cstr-note, r=steveklabnik

Add new warning for CStr::from_ptr

Fixes #48401.
This commit is contained in:
kennytm 2018-03-06 18:20:35 +08:00
commit ebc6d6e24f
No known key found for this signature in database
GPG Key ID: FEF6C8051D0E013C

View File

@ -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