Add more information to safety comment

This commit is contained in:
dylni 2020-08-24 10:53:25 -04:00
parent d04e6b8de5
commit d9e877fb98

View File

@ -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);