about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authoraticu <15schnic@gmail.com>2020-07-25 14:06:32 +0200
committeraticu <15schnic@gmail.com>2020-07-25 14:06:32 +0200
commit44d8b4c8b12be337156d8e21ca8103ef9704840e (patch)
tree45abcb9ba1eb41b121db720752cee740c14793ce /src/liballoc
parente7949bc2f41e710deb97f9e1da2a599563b1faf4 (diff)
downloadrust-44d8b4c8b12be337156d8e21ca8103ef9704840e.tar.gz
rust-44d8b4c8b12be337156d8e21ca8103ef9704840e.zip
Document UTF-8 validity of String::from_raw_parts
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/string.rs1
1 files changed, 1 insertions, 0 deletions
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.