docs/bevy/release-content/migration-guides/ptr_as_ptr.md 386 B · 10 lines · raw · history

1 ---
2 title: Ptr::as_ptr now returns a *const u8.
3 pull_requests: [25745]
4 ---
5
6 In previous versions, `Ptr::as_ptr` returned a `*mut u8`. However, `Ptr` is intended to be like an
7 immutable borrow. To make these semantics clearer, `Ptr::as_ptr` now returns `*const u8`.
8
9 To maintain the previous behavior, simply cast the `*const u8` to `*mut u8`. For example:
10 `my_ptr.as_ptr().cast_mut()`.