You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After Rust 1.77 `u128` starts requiring 16 bytes aligned values. This
breaks Metal, where `retrieve_contents` assumed it could just cast the
pointer and treat it as a slice.
Instead, we need to assume no alignment by doing the following:
1. Read the `i-th` element from the buffer with
`ptr.add(i).read_unaligned()`;
2. `clone` the read value, as the bitwise copy may cause aliasing
otherwise;
3. `push` the `clone`d value into the vector;
4. `mem::forget` the element we read to avoid calling its `drop`
implementation twice, one for the copy and one for the `Buffer`.
0 commit comments