@@ -64,14 +64,14 @@ impl AsciiString {
64
64
/// This is highly unsafe, due to the number of invariants that aren't checked:
65
65
///
66
66
/// * 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.
69
68
/// * `length` needs to be less than or equal to `capacity`.
70
69
/// * `capacity` needs to be the correct value.
71
70
/// * `buf` must have `length` valid ascii elements and contain a total of `capacity` total,
72
71
/// possibly, uninitialized, elements.
72
+ /// * Nothing else must be using the memory `buf` points to.
73
73
///
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 .
75
75
///
76
76
/// # Examples
77
77
///
@@ -98,9 +98,9 @@ impl AsciiString {
98
98
#[ must_use]
99
99
pub unsafe fn from_raw_parts ( buf : * mut AsciiChar , length : usize , capacity : usize ) -> Self {
100
100
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 .
104
104
vec : unsafe { Vec :: from_raw_parts ( buf, length, capacity) } ,
105
105
}
106
106
}
0 commit comments