diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-02 21:05:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-02 21:05:37 -0800 |
| commit | 61fb909559bc61e2179f3ea7b62b60e2e7df3ac0 (patch) | |
| tree | bf0b0e3c332d9ae9bb3c7aa254d228ea299cceb3 /src/liballoc | |
| parent | ac642aba074969860f9fb53fb9e2d52f0e0203cb (diff) | |
| download | rust-61fb909559bc61e2179f3ea7b62b60e2e7df3ac0.tar.gz rust-61fb909559bc61e2179f3ea7b62b60e2e7df3ac0.zip | |
Update src/liballoc/vec.rs
Add @centril's comment Co-Authored-By: scottmcm <scottmcm@users.noreply.github.com>
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index b987b94500f..30bcc034221 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -790,6 +790,10 @@ impl<T> Vec<T> { /// // Per the FFI method's docs, "32768 bytes is always enough". /// let mut dict = Vec::with_capacity(32_768); /// let mut dict_length = 0; + /// // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that: + /// // 1. `dict_length` elements were initialized. + /// // 2. `dict_length` <= the capacity (32_768) + /// // which makes `set_len` safe to call. /// unsafe { /// // Make the FFI call... /// let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length); |
