File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
gix-features/src/parallel Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -229,11 +229,12 @@ where
229
229
. expect ( "valid name" ) ;
230
230
231
231
let input_len = input. len ( ) ;
232
- struct Input < I > ( * mut [ I ] )
232
+ struct Input < I > ( * mut I )
233
233
where
234
234
I : Send ;
235
235
236
- // SAFETY: I is Send + Sync, so is a *mut [I]
236
+ // SAFETY: I is Send, and we only use the pointer for creating new
237
+ // pointers (within the input slice) from the threads.
237
238
#[ allow( unsafe_code) ]
238
239
unsafe impl < I > Send for Input < I > where I : Send { }
239
240
@@ -245,7 +246,7 @@ where
245
246
let new_thread_state = new_thread_state. clone ( ) ;
246
247
let state_to_rval = state_to_rval. clone ( ) ;
247
248
let mut consume = consume. clone ( ) ;
248
- let input = Input ( input as * mut [ I ] ) ;
249
+ let input = Input ( input. as_mut_ptr ( ) ) ;
249
250
move || {
250
251
let _ = & input;
251
252
threads_left. fetch_sub ( 1 , Ordering :: SeqCst ) ;
@@ -264,7 +265,7 @@ where
264
265
let item = {
265
266
#[ allow( unsafe_code) ]
266
267
unsafe {
267
- & mut ( & mut * input. 0 ) [ input_index]
268
+ & mut * input. 0 . add ( input_index)
268
269
}
269
270
} ;
270
271
if let Err ( err) = consume ( item, & mut state, threads_left, stop_everything) {
You can’t perform that action at this time.
0 commit comments