bevy/crates
Boxy 512f376fc1 Document alignment requirements of Ptr, PtrMut and OwningPtr (#7151)
# Objective

The types in the `bevy_ptr` accidentally did not document anything relating to alignment. This is unsound as many methods rely on the pointer being correctly aligned. 

## Solution

This PR introduces new safety invariants on the `$ptr::new`, `$ptr::byte_offset` and `$ptr::byte_add` methods requiring them to keep the pointer aligned. This is consistent with the documentation of these pointer types which document them as being "type erased borrows".

As it was pointed out (by @JoJoJet in #7117) that working with unaligned pointers can be useful (for example our commands abstraction which does not try to align anything properly, see #7039) this PR also introduces a default type parameter to all the pointer types that specifies whether it has alignment requirements or not. I could not find any code in `bevy_ecs` that would need unaligned pointers right now so this is going unused.

---

## Changelog

- Correctly document alignment requirements on `bevy_ptr` types.
- Support variants of `bevy_ptr` types that do not require being correctly aligned for the pointee type.

## Migration Guide

- Safety invariants on `bevy_ptr` types' `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness.
2023-01-10 23:12:52 +00:00
..
bevy_animation Smooth Transition between Animations (#6922) 2023-01-09 19:24:51 +00:00
bevy_app Fix doc in App::add_sub_app (#7139) 2023-01-09 21:43:29 +00:00
bevy_asset Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_audio Expose symphonia features from rodio in bevy_audio and bevy (#6388) 2023-01-09 19:05:30 +00:00
bevy_core Break CorePlugin into TaskPoolPlugin, TypeRegistrationPlugin, FrameCountPlugin. (#7083) 2023-01-05 11:42:35 +00:00
bevy_core_pipeline Reduce branching in TrackedRenderPass (#7053) 2023-01-09 19:24:56 +00:00
bevy_derive Fix ndk-macro link (#7027) 2022-12-25 05:06:03 +00:00
bevy_diagnostic Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_dylib Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_dynamic_plugin Adapt path type of dynamically_load_plugin (#6734) 2022-12-05 23:39:43 +00:00
bevy_ecs Make Query fields private (#7149) 2023-01-10 18:55:23 +00:00
bevy_ecs_compile_fail_tests Fix clippy lints and failed test with Rust 1.66 (#6945) 2022-12-15 18:05:15 +00:00
bevy_encase_derive Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_gilrs Gamepad events refactor (#6965) 2023-01-09 19:24:52 +00:00
bevy_gltf enum Visibility component (#6320) 2022-12-25 00:39:29 +00:00
bevy_hierarchy Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_input Gamepad events refactor (#6965) 2023-01-09 19:24:52 +00:00
bevy_internal Expose symphonia features from rodio in bevy_audio and bevy (#6388) 2023-01-09 19:05:30 +00:00
bevy_log Fix suppression of all console logs when trace_tracy is enabled (#6955) 2022-12-20 23:45:43 +00:00
bevy_macro_utils Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_math Improve code/comments for Ray::intersect_plane and its tests (#6823) 2022-12-05 22:49:06 +00:00
bevy_mikktspace Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_pbr Reduce branching in TrackedRenderPass (#7053) 2023-01-09 19:24:56 +00:00
bevy_ptr Document alignment requirements of Ptr, PtrMut and OwningPtr (#7151) 2023-01-10 23:12:52 +00:00
bevy_reflect Add TypeRegistrationDeserializer and remove BorrowedStr (#7094) 2023-01-09 21:57:14 +00:00
bevy_reflect_compile_fail_tests bevy_reflect: Add compile fail tests for bevy_reflect (#7041) 2023-01-02 21:07:33 +00:00
bevy_render Panic on dropping NonSend in non-origin thread. (#6534) 2023-01-09 20:40:34 +00:00
bevy_scene Add TypeRegistrationDeserializer and remove BorrowedStr (#7094) 2023-01-09 21:57:14 +00:00
bevy_sprite Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_tasks Thread executor for running tasks on specific threads. (#7087) 2023-01-10 22:32:42 +00:00
bevy_text Remove TextError::ExceedMaxTextAtlases(usize) variant (#6796) 2022-12-05 23:23:16 +00:00
bevy_time Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_transform Remove the GlobalTransform::translation_mut method (#7134) 2023-01-10 18:55:22 +00:00
bevy_ui Fix overflow scaling for images (#7142) 2023-01-09 21:43:30 +00:00
bevy_utils Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_window Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_winit fix cursor grab issue (#7010) 2023-01-04 23:00:12 +00:00