From 44d8b4c8b12be337156d8e21ca8103ef9704840e Mon Sep 17 00:00:00 2001 From: aticu <15schnic@gmail.com> Date: Sat, 25 Jul 2020 14:06:32 +0200 Subject: Document UTF-8 validity of String::from_raw_parts --- src/liballoc/string.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/liballoc/string.rs') diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 798ab84069a..05398ca68c8 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -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. -- cgit 1.4.1-3-g733a5