We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ac642ab commit 61fb909Copy full SHA for 61fb909
src/liballoc/vec.rs
@@ -790,6 +790,10 @@ impl<T> Vec<T> {
790
/// // Per the FFI method's docs, "32768 bytes is always enough".
791
/// let mut dict = Vec::with_capacity(32_768);
792
/// 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.
797
/// unsafe {
798
/// // Make the FFI call...
799
/// let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);
0 commit comments