File tree 2 files changed +5
-1
lines changed
gix-pack/src/cache/delta/traverse
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ mod node {
57
57
/// Children are `Node`s referring to pack entries whose base object is this pack entry.
58
58
pub fn into_child_iter ( self ) -> impl Iterator < Item = Node < ' a , T > > + ' a {
59
59
let children = self . child_items ;
60
+ // SAFETY: The index is a valid index into the children array.
60
61
// SAFETY: The resulting mutable pointer cannot be yielded by any other node.
61
62
#[ allow( unsafe_code) ]
62
63
self . item . children . iter ( ) . map ( move |& index| Node {
Original file line number Diff line number Diff line change 5
5
T : Send ,
6
6
{
7
7
items : * mut T ,
8
+ #[ cfg( debug_assertions) ]
8
9
len : usize ,
9
10
phantom : PhantomData < & ' a T > ,
10
11
}
@@ -16,14 +17,16 @@ where
16
17
pub fn new ( items : & ' a mut [ T ] ) -> Self {
17
18
ItemSliceSync {
18
19
items : items. as_mut_ptr ( ) ,
20
+ #[ cfg( debug_assertions) ]
19
21
len : items. len ( ) ,
20
22
phantom : PhantomData ,
21
23
}
22
24
}
23
25
24
- // SAFETY: The index must not be reused concurrently
26
+ // SAFETY: The index must point into the slice and must not be reused concurrently.
25
27
#[ allow( unsafe_code) ]
26
28
pub unsafe fn get_mut ( & self , index : usize ) -> & ' a mut T {
29
+ #[ cfg( debug_assertions) ]
27
30
if index >= self . len {
28
31
panic ! ( "index out of bounds: the len is {} but the index is {index}" , self . len) ;
29
32
}
You can’t perform that action at this time.
0 commit comments