@@ -100,10 +100,11 @@ impl<T> RawVec<T, Global> {
100
100
101
101
/// Reconstitutes a `RawVec` from a pointer and capacity.
102
102
///
103
- /// # Undefined Behavior
103
+ /// # Safety
104
104
///
105
105
/// The `ptr` must be allocated (on the system heap), and with the given `capacity`.
106
- /// The `capacity` cannot exceed `isize::MAX` (only a concern on 32-bit systems).
106
+ /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
107
+ /// systems). ZSTs may have a capacity up to `usize::MAX`.
107
108
/// If the `ptr` and `capacity` come from a `RawVec`, then this is guaranteed.
108
109
#[ inline]
109
110
pub unsafe fn from_raw_parts ( ptr : * mut T , capacity : usize ) -> Self {
@@ -160,10 +161,11 @@ impl<T, A: AllocRef> RawVec<T, A> {
160
161
161
162
/// Reconstitutes a `RawVec` from a pointer, capacity, and allocator.
162
163
///
163
- /// # Undefined Behavior
164
+ /// # Safety
164
165
///
165
166
/// The `ptr` must be allocated (via the given allocator `a`), and with the given `capacity`.
166
- /// The `capacity` cannot exceed `isize::MAX` (only a concern on 32-bit systems).
167
+ /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
168
+ /// systems). ZSTs may have a capacity up to `usize::MAX`.
167
169
/// If the `ptr` and `capacity` come from a `RawVec` created via `a`, then this is guaranteed.
168
170
#[ inline]
169
171
pub unsafe fn from_raw_parts_in ( ptr : * mut T , capacity : usize , a : A ) -> Self {
0 commit comments