File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
gix-pack/src/cache/delta/traverse Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -130,18 +130,14 @@ where
130130 } ;
131131 size_progress. init ( None , progress:: bytes ( ) ) ;
132132 let size_counter = size_progress. counter ( ) ;
133- let child_items = self . child_items . as_mut_slice ( ) ;
134133 let object_progress = OwnShared :: new ( Mutable :: new ( object_progress) ) ;
135134
136135 let start = std:: time:: Instant :: now ( ) ;
137136 in_parallel_with_slice (
138137 & mut self . root_items ,
139138 thread_limit,
140139 {
141- let child_items = ItemSliceSend ( std:: ptr:: slice_from_raw_parts_mut (
142- child_items. as_mut_ptr ( ) ,
143- child_items. len ( ) ,
144- ) ) ;
140+ let child_items = ItemSliceSend :: new ( & mut self . child_items ) ;
145141 {
146142 let object_progress = object_progress. clone ( ) ;
147143 move |thread_index| {
Original file line number Diff line number Diff line change 11use crate :: cache:: delta:: Item ;
22
3- pub struct ItemSliceSend < T > ( pub * mut [ T ] )
3+ pub struct ItemSliceSend < T > ( * mut [ T ] )
44where
55 T : Send ;
66
7+ impl < T > ItemSliceSend < T >
8+ where
9+ T : Send ,
10+ {
11+ pub fn new ( items : & mut [ T ] ) -> Self {
12+ ItemSliceSend ( std:: ptr:: slice_from_raw_parts_mut ( items. as_mut_ptr ( ) , items. len ( ) ) )
13+ }
14+ }
15+
716/// SAFETY: This would be unsafe if this would ever be abused, but it's used internally and only in a way that assure that the pointers
817/// don't violate aliasing rules.
918impl < T > Clone for ItemSliceSend < T >
You can’t perform that action at this time.
0 commit comments