mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-04 14:58:12 +08:00
Back the repark test's element slot with word storage
This commit is contained in:
@@ -750,10 +750,11 @@ mod tests {
|
|||||||
let copy = unsafe { (out.element.clone_out)(out.rec(&value).ptr()) };
|
let copy = unsafe { (out.element.clone_out)(out.rec(&value).ptr()) };
|
||||||
|
|
||||||
let replay_arena = Arena::new(1 << 16).unwrap();
|
let replay_arena = Arena::new(1 << 16).unwrap();
|
||||||
let mut slot = [0u8; 8];
|
// Word storage: a parked element slot holds an 8-aligned reference.
|
||||||
unsafe { (out.element.repark)(&*copy, slot.as_mut_ptr(), &replay_arena) }.expect("the arena holds the replay");
|
let mut slot = [0u64; 1];
|
||||||
|
unsafe { (out.element.repark)(&*copy, slot.as_mut_ptr().cast(), &replay_arena) }.expect("the arena holds the replay");
|
||||||
// SAFETY: the re-park wrote a parked `Graphic` element into `slot`.
|
// SAFETY: the re-park wrote a parked `Graphic` element into `slot`.
|
||||||
let Graphic::Group(group) = (unsafe { record::borrow_element::<Graphic>(record::Rec::new(slot.as_ptr())) }) else {
|
let Graphic::Group(group) = (unsafe { record::borrow_element::<Graphic>(record::Rec::new(slot.as_ptr().cast())) }) else {
|
||||||
panic!("the replay restores the group element");
|
panic!("the replay restores the group element");
|
||||||
};
|
};
|
||||||
let item = &group.content;
|
let item = &group.content;
|
||||||
|
|||||||
Reference in New Issue
Block a user