Skip to content

Commit 44d8b4c

Browse files
committed
Document UTF-8 validity of String::from_raw_parts
1 parent e7949bc commit 44d8b4c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/liballoc/string.rs

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

0 commit comments

Comments
 (0)