Document UTF-8 validity of String::from_raw_parts

This commit is contained in:
aticu 2020-07-25 14:06:32 +02:00
parent e7949bc2f4
commit 44d8b4c8b1

View File

@ -671,6 +671,7 @@ impl String {
/// same allocator the standard library uses, with a required alignment of exactly 1.
/// * `length` needs to be less than or equal to `capacity`.
/// * `capacity` needs to be the correct value.
/// * The first `length` bytes at `buf` need to be valid UTF-8.
///
/// Violating these may cause problems like corrupting the allocator's
/// internal data structures.