The library marks a lot of types that are explicitly !Send and !Sync (meaning they can't be shared between threads) with unsafe impl Send and unsafe impl Sync. Considering that these types are actively used in the context of Bevy systems and wrapped into resources accessed with Res/ResMut, it's very likely to lead to UB.
We should remove all the unsafe impl Send and unsafe impl Sync occurrences, even if it means that resources can no longer be accessed from different threads. Bevy supports NonSend, and I'd argue that limiting systems to run only on the main thread is a better compromise than causing UB.
The library marks a lot of types that are explicitly
!Send
and!Sync
(meaning they can't be shared between threads) withunsafe impl Send
andunsafe impl Sync
. Considering that these types are actively used in the context of Bevy systems and wrapped into resources accessed withRes
/ResMut
, it's very likely to lead to UB.Unsafe types in question: https://github.com/search?q=repo%3Anaia-lib%2Fnaia+%22unsafe+impl%22&type=code
We should remove all the
unsafe impl Send
andunsafe impl Sync
occurrences, even if it means that resources can no longer be accessed from different threads. Bevy supportsNonSend
, and I'd argue that limiting systems to run only on the main thread is a better compromise than causing UB.