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
130
130
} ;
131
131
size_progress. init ( None , progress:: bytes ( ) ) ;
132
132
let size_counter = size_progress. counter ( ) ;
133
- let child_items = self . child_items . as_mut_slice ( ) ;
134
133
let object_progress = OwnShared :: new ( Mutable :: new ( object_progress) ) ;
135
134
136
135
let start = std:: time:: Instant :: now ( ) ;
137
136
in_parallel_with_slice (
138
137
& mut self . root_items ,
139
138
thread_limit,
140
139
{
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 ) ;
145
141
{
146
142
let object_progress = object_progress. clone ( ) ;
147
143
move |thread_index| {
Original file line number Diff line number Diff line change 1
1
use crate :: cache:: delta:: Item ;
2
2
3
- pub struct ItemSliceSend < T > ( pub * mut [ T ] )
3
+ pub struct ItemSliceSend < T > ( * mut [ T ] )
4
4
where
5
5
T : Send ;
6
6
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
+
7
16
/// 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
8
17
/// don't violate aliasing rules.
9
18
impl < T > Clone for ItemSliceSend < T >
You can’t perform that action at this time.
0 commit comments