candle icon indicating copy to clipboard operation
candle copied to clipboard

Refactor usages of "from_raw_parts" to use bytemuck utilities instead

Open tomsanbear opened this issue 1 year ago • 0 comments
trafficstars

Leaving as a draft to solicit feedback on the introduction of this package.

During my research on WebGPU it seemed like this was a pretty common util being used in the webgpu project, it seems like it could be worth offloading the safety of our unsafe code to this purpose built package. If we are open to this then I'll go ahead and replace pretty much all of our usages of the from_raw_parts to use this package so that safety is handled for us. Seems that the CPU package also has a lot of reliance on this too.

When running the example from this issue, this branch correctly throws an error in release builds cast_slice>TargetAlignmentGreaterAndInputNotAligned whereas on main the example runs without error.

tomsanbear avatar Apr 13 '24 14:04 tomsanbear