about summary refs log tree commit diff
path: root/library/alloc
diff options
context:
space:
mode:
authorThe 8472 <git@infinite-source.de>2023-04-29 21:47:24 +0200
committerThe 8472 <git@infinite-source.de>2023-12-11 23:38:48 +0100
commit6a2f44e9d850d241e9483792710dba7c58a249ec (patch)
tree3d753701cce40d9439d7d36095fbab3ab2c9f2d6 /library/alloc
parent502df1b7d4f3ba61d55cf2b3a47785a7a4df940b (diff)
downloadrust-6a2f44e9d850d241e9483792710dba7c58a249ec.tar.gz
rust-6a2f44e9d850d241e9483792710dba7c58a249ec.zip
add comment to RawVec::cap field
Diffstat (limited to 'library/alloc')
-rw-r--r--library/alloc/src/raw_vec.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs
index 52b2948060f..99ec68f5aa5 100644
--- a/library/alloc/src/raw_vec.rs
+++ b/library/alloc/src/raw_vec.rs
@@ -60,6 +60,11 @@ impl Cap {
 #[allow(missing_debug_implementations)]
 pub(crate) struct RawVec<T, A: Allocator = Global> {
     ptr: Unique<T>,
+    /// Never used for ZSTs; it's `capacity()`'s responsibility to return usize::MAX in that case.
+    ///
+    /// # Safety
+    ///
+    /// `cap` must be in the `0..=isize::MAX` range.
     cap: Cap,
     alloc: A,
 }