Skip to content

Commit

Permalink
Add more information to safety comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dylni committed Aug 24, 2020
1 parent d04e6b8 commit d9e877f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/alloc/src/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d9e877f

Please sign in to comment.