diff options
| author | dylni <46035563+dylni@users.noreply.github.com> | 2020-08-24 10:53:25 -0400 |
|---|---|---|
| committer | dylni <46035563+dylni@users.noreply.github.com> | 2020-08-24 10:53:25 -0400 |
| commit | d9e877fb98212a47dd425e145b8b3e4283e6b487 (patch) | |
| tree | 7b0f1ee5f8ca467f097b83f2046992a73abcb5ec | |
| parent | d04e6b8de5fe6bbf203c534c35e6f55e8960ab46 (diff) | |
| download | rust-d9e877fb98212a47dd425e145b8b3e4283e6b487.tar.gz rust-d9e877fb98212a47dd425e145b8b3e4283e6b487.zip | |
Add more information to safety comment
| -rw-r--r-- | library/alloc/src/collections/vec_deque.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/alloc/src/collections/vec_deque.rs b/library/alloc/src/collections/vec_deque.rs index 54cf548fac5..04014c8eb5a 100644 --- a/library/alloc/src/collections/vec_deque.rs +++ b/library/alloc/src/collections/vec_deque.rs @@ -1086,7 +1086,9 @@ impl<T> VecDeque<T> { where R: RangeBounds<usize>, { - // SAFETY: This buffer is only used to check the range. + // SAFETY: This buffer is only used to check the range. It might be partially + // uninitialized, but `check_range` needs a contiguous slice. + // https://github.com/rust-lang/rust/pull/75207#discussion_r471193682 let buffer = unsafe { slice::from_raw_parts(self.ptr(), self.len()) }; let Range { start, end } = buffer.check_range(range); let tail = self.wrap_add(self.tail, start); |
