Skip to content

Commit d9e877f

Browse files
committed
Add more information to safety comment
1 parent d04e6b8 commit d9e877f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/alloc/src/collections/vec_deque.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,9 @@ impl<T> VecDeque<T> {
10861086
where
10871087
R: RangeBounds<usize>,
10881088
{
1089-
// SAFETY: This buffer is only used to check the range.
1089+
// SAFETY: This buffer is only used to check the range. It might be partially
1090+
// uninitialized, but `check_range` needs a contiguous slice.
1091+
// https://github.com/rust-lang/rust/pull/75207#discussion_r471193682
10901092
let buffer = unsafe { slice::from_raw_parts(self.ptr(), self.len()) };
10911093
let Range { start, end } = buffer.check_range(range);
10921094
let tail = self.wrap_add(self.tail, start);

0 commit comments

Comments
 (0)