Same reasoning as for the fix in in_parallel.rs. Thanks to @cramertj for spotting this.
Unified · Split
| @@ -1,6 +1,6 @@ | |||
| 1 | use crate::cache::delta::Item; | 1 | use crate::cache::delta::Item; |
| 2 | 2 | ||
| 3 | pub struct ItemSliceSend<T>(*mut [T]) | 3 | pub struct ItemSliceSend<T>(*mut T) |
| 4 | where | 4 | where |
| 5 | T: Send; | 5 | T: Send; |
| 6 | 6 | ||
| @@ -9,7 +9,7 @@ where · 2 unmodified lines | |||
| 9 | T: Send, | 9 | T: Send, |
| 10 | { | 10 | { |
| 11 | pub fn new(items: &mut [T]) -> Self { | 11 | pub fn new(items: &mut [T]) -> Self { |
| 12 | ItemSliceSend(std::ptr::slice_from_raw_parts_mut(items.as_mut_ptr(), items.len())) | 12 | ItemSliceSend(items.as_mut_ptr()) |
| 13 | } | 13 | } |
| 14 | } | 14 | } |
| 15 | 15 | ||
| @@ -66,7 +66,7 @@ impl<'a, T: Send> Node<'a, T> { · 50 unmodified lines | |||
| 66 | // SAFETY: The resulting mutable pointer cannot be yielded by any other node. | 66 | // SAFETY: The resulting mutable pointer cannot be yielded by any other node. |
| 67 | #[allow(unsafe_code)] | 67 | #[allow(unsafe_code)] |
| 68 | Node { | 68 | Node { |
| 69 | item: &mut unsafe { &mut *children.0 }[index as usize], | 69 | item: unsafe { &mut *children.0.add(index as usize) }, |
| 70 | child_items: children.clone(), | 70 | child_items: children.clone(), |
| 71 | } | 71 | } |
| 72 | }) | 72 | }) |