Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ impl<A: Array> SmallVec<A> {
// In our case, this also ensures that a smallvec of zero-size items
// never spills, and we never try to allocate zero bytes
// which `std::alloc::alloc` disallows.
#[allow(deprecated)]
core::usize::MAX
}
}
Expand Down Expand Up @@ -1490,8 +1491,10 @@ impl<A: Array> SmallVec<A> {
}

let (lower_size_bound, _) = iter.size_hint();
assert!(lower_size_bound <= core::isize::MAX as usize); // Ensure offset
// is indexable
#[allow(deprecated)]
{
assert!(lower_size_bound <= core::isize::MAX as usize)
} // Ensure offset is indexable
assert!(index + lower_size_bound >= index); // Protect against overflow

let mut num_added = 0;
Expand Down
1 change: 1 addition & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ fn test_invalid_grow() {
#[should_panic]
fn drain_overflow() {
let mut v: SmallVec<[u8; 8]> = smallvec![0];
#[allow(deprecated)]
v.drain(..=std::usize::MAX);
}

Expand Down
Loading