This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -667,15 +667,16 @@ impl String {
667667 /// This is highly unsafe, due to the number of invariants that aren't
668668 /// checked:
669669 ///
670- /// * The memory at `ptr ` needs to have been previously allocated by the
670+ /// * The memory at `buf ` needs to have been previously allocated by the
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.
677678 ///
678- /// The ownership of `ptr ` is effectively transferred to the
679+ /// The ownership of `buf ` is effectively transferred to the
679680 /// `String` which may then deallocate, reallocate or change the
680681 /// contents of memory pointed to by the pointer at will. Ensure
681682 /// that nothing else uses the pointer after calling this
You can’t perform that action at this time.
0 commit comments