rtic/rtic-macros
Oleksandr Babak 3d0ced0bd1
fix: make mutexes !Send
Each mutex is generated uniquely for each task, it is unsound to send
them between tasks. But they are `Send`. Before, it wasn't an issue,
because you couldn't share non-`'static` data between them, but with
\#1043 you can make the mutex `'static`. Thus we need to use actual
tools that Rust provides and out out from `Send`.

Currently, mutexes are simple ZSTs with `PhantomData<&'a ()>`, which is `Send`.
We replace it with `PhantomData<(&'a (), *const u8)>`, and return `Sync`
back via `unsafe` implementation. It is trivially sound, because mutexes have
no method methods that accept `&self`.

See https://doc.rust-lang.org/std/sync/struct.Exclusive.html for details.
2025-10-28 14:06:54 +01:00
..
src fix: make mutexes !Send 2025-10-28 14:06:54 +01:00
tests
ui chore: update tests 2025-03-27 14:47:11 +00:00
.gitignore
Cargo.toml Release all crates 2025-06-22 09:34:16 +00:00
CHANGELOG.md Update CHANGELOGs 2025-09-17 19:40:38 +02:00