Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace some unsafe system executor code with safe code (#8274)
# Objective The function `SyncUnsafeCell::from_mut` returns `&SyncUnsafeCell<T>`, even though it could return `&mut SyncUnsafeCell<T>`. This means it is not possible to call `get_mut` on the returned value, so you need to use unsafe code to get exclusive access back. ## Solution Return `&mut Self` instead of `&Self` in `SyncUnsafeCell::from_mut`. This is consistent with my proposal for `UnsafeCell::from_mut`: rust-lang/libs-team#198. Replace an unsafe pointer dereference with a safe call to `get_mut`. --- ## Changelog + The function `bevy_utils::SyncUnsafeCell::get_mut` now returns a value of type `&mut SyncUnsafeCell<T>`. Previously, this returned an immutable reference. ## Migration Guide The function `bevy_utils::SyncUnsafeCell::get_mut` now returns a value of type `&mut SyncUnsafeCell<T>`. Previously, this returned an immutable reference.
- Loading branch information