mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
ae39b07d26
# 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`: https://github.com/rust-lang/libs-team/issues/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. |
||
---|---|---|
.. | ||
macros | ||
src | ||
Cargo.toml |