@@ -64,14 +64,14 @@ impl AsciiString {
6464 /// This is highly unsafe, due to the number of invariants that aren't checked:
6565 ///
6666 /// * The memory at `buf` need to have been previously allocated by the same allocator this
67- /// library uses.
68- /// * `buf` must be obtained from a valid `&mut` reference to guarentee exclusive ownership.
67+ /// library uses, with an alignment of 1.
6968 /// * `length` needs to be less than or equal to `capacity`.
7069 /// * `capacity` needs to be the correct value.
7170 /// * `buf` must have `length` valid ascii elements and contain a total of `capacity` total,
7271 /// possibly, uninitialized, elements.
72+ /// * Nothing else must be using the memory `buf` points to.
7373 ///
74- /// Violating these may cause problems like corrupting the allocator's internal datastructures .
74+ /// Violating these may cause problems like corrupting the allocator's internal data structures .
7575 ///
7676 /// # Examples
7777 ///
@@ -98,9 +98,9 @@ impl AsciiString {
9898 #[ must_use]
9999 pub unsafe fn from_raw_parts ( buf : * mut AsciiChar , length : usize , capacity : usize ) -> Self {
100100 AsciiString {
101- // SAFETY: Caller guarantees `buf` was previously allocated by this library,
102- // is a unique pointer, `buf` contains `length` valid ascii elements,
103- // and has a total capacity of `capacity` elements .
101+ // SAFETY: Caller guarantees that `buf` was previously allocated by this library,
102+ // that `buf` contains `length` valid ascii elements and has a total capacity
103+ // of `capacity` elements, and that nothing else is using the momory .
104104 vec : unsafe { Vec :: from_raw_parts ( buf, length, capacity) } ,
105105 }
106106 }
0 commit comments