Skip to content

Commit 61fb909

Browse files
Centrilscottmcm
andauthored
Update src/liballoc/vec.rs
Add @Centril's comment Co-Authored-By: scottmcm <[email protected]>
1 parent ac642ab commit 61fb909

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/liballoc/vec.rs

+4
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,10 @@ impl<T> Vec<T> {
790790
/// // Per the FFI method's docs, "32768 bytes is always enough".
791791
/// let mut dict = Vec::with_capacity(32_768);
792792
/// let mut dict_length = 0;
793+
/// // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:
794+
/// // 1. `dict_length` elements were initialized.
795+
/// // 2. `dict_length` <= the capacity (32_768)
796+
/// // which makes `set_len` safe to call.
793797
/// unsafe {
794798
/// // Make the FFI call...
795799
/// let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);

0 commit comments

Comments
 (0)