summaryrefslogtreecommitdiff
path: root/rust/zerocopy/src/byte_slice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/zerocopy/src/byte_slice.rs')
-rw-r--r--rust/zerocopy/src/byte_slice.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/rust/zerocopy/src/byte_slice.rs b/rust/zerocopy/src/byte_slice.rs
index b7f85098dbc4..26fcc088aecf 100644
--- a/rust/zerocopy/src/byte_slice.rs
+++ b/rust/zerocopy/src/byte_slice.rs
@@ -427,8 +427,12 @@ mod tests {
let borrow_mut = cell.borrow_mut();
let slice_ref_mut: cell::RefMut<'_, [u8]> = cell::RefMut::map(borrow_mut, |a| &mut a[..]);
// SAFETY: 2 is within bounds of [1, 2, 3, 4]
- let (l, r) = unsafe { slice_ref_mut.split_at_unchecked(2) };
+ let (mut l, mut r) = unsafe { slice_ref_mut.split_at_unchecked(2) };
assert_eq!(*l, [1, 2]);
assert_eq!(*r, [3, 4]);
+ l[0] = 5;
+ r[0] = 6;
+ drop((l, r));
+ assert_eq!(*cell.borrow(), [5, 2, 6, 4]);
}
}