Skip to content

Commit 3653e16

Browse files
Add safety comment.
Co-authored-by: Jubilee <[email protected]>
1 parent 0a6ae78 commit 3653e16

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ impl<A: Array> SmallVec<A> {
13751375
if index > len {
13761376
panic!("index exceeds length");
13771377
}
1378+
// SAFETY: add is UB if index > len, but we panicked first
13781379
ptr = ptr.add(index);
13791380
if index < len {
13801381
// Shift element to the right of `index`.

0 commit comments

Comments
 (0)