about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorTim Diekmann <tim.diekmann@3dvision.de>2020-03-25 18:44:29 +0100
committerTim Diekmann <tim.diekmann@3dvision.de>2020-03-26 17:13:11 +0100
commitad7de67a32d40360ad36d03845c5a7004ba68150 (patch)
treecebcf96a45e1b75d1111b63805413b1a6a6ecc7c /src/liballoc
parentaae3c52c7aaa9115ba8f34604c34a11f7d4f5e2e (diff)
downloadrust-ad7de67a32d40360ad36d03845c5a7004ba68150.tar.gz
rust-ad7de67a32d40360ad36d03845c5a7004ba68150.zip
Refine docs for `RawVec::from_raw_parts(_in)`
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/raw_vec.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index ba810bf5faf..79dfa7b6b45 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -100,10 +100,11 @@ impl<T> RawVec<T, Global> {
 
     /// Reconstitutes a `RawVec` from a pointer and capacity.
     ///
-    /// # Undefined Behavior
+    /// # Safety
     ///
     /// The `ptr` must be allocated (on the system heap), and with the given `capacity`.
-    /// The `capacity` cannot exceed `isize::MAX` (only a concern on 32-bit systems).
+    /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
+    /// systems). ZSTs may have a capacity up to `usize::MAX`.
     /// If the `ptr` and `capacity` come from a `RawVec`, then this is guaranteed.
     #[inline]
     pub unsafe fn from_raw_parts(ptr: *mut T, capacity: usize) -> Self {
@@ -160,10 +161,11 @@ impl<T, A: AllocRef> RawVec<T, A> {
 
     /// Reconstitutes a `RawVec` from a pointer, capacity, and allocator.
     ///
-    /// # Undefined Behavior
+    /// # Safety
     ///
     /// The `ptr` must be allocated (via the given allocator `a`), and with the given `capacity`.
-    /// The `capacity` cannot exceed `isize::MAX` (only a concern on 32-bit systems).
+    /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
+    /// systems). ZSTs may have a capacity up to `usize::MAX`.
     /// If the `ptr` and `capacity` come from a `RawVec` created via `a`, then this is guaranteed.
     #[inline]
     pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, a: A) -> Self {