[v3,0/4] Update thread safety markers

Message ID 20230531145939.3714886-1-aliceryhl@google.com
Headers
Series Update thread safety markers |

Message

Alice Ryhl May 31, 2023, 2:59 p.m. UTC
  In Rust, the `Send` and `Sync` traits are used to mark in what ways a
specific type is thread safe. In this patch series, I add some missing
thread safety markers and improve the documentation related to them.
This change will let you compile some code that would currently fail to
compile even though it doesn't actually violate any thread safety rules.

You can find a definition of what these marker traits mean at [1].

Changes since v2:

 * Removed "for example" as suggested in [2].
 * Added Reviewed-by annotations from v2 review.

[1]: https://stackoverflow.com/a/68708557/1704411
[2]: https://lore.kernel.org/all/20230523165027.71600b4b.gary@garyguo.net/

Alice Ryhl (4):
  rust: sync: reword the `Arc` safety comment for `Send`
  rust: sync: reword the `Arc` safety comment for `Sync`
  rust: specify when `ARef` is thread safe
  rust: task: add `Send` marker to `Task`

 rust/kernel/sync/arc.rs | 12 +++++++-----
 rust/kernel/task.rs     | 10 ++++++++--
 rust/kernel/types.rs    | 13 +++++++++++++
 3 files changed, 28 insertions(+), 7 deletions(-)


base-commit: ac9a78681b921877518763ba0e89202254349d1b
  

Comments

Miguel Ojeda May 31, 2023, 5:14 p.m. UTC | #1
On Wed, May 31, 2023 at 5:00 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> In Rust, the `Send` and `Sync` traits are used to mark in what ways a
> specific type is thread safe. In this patch series, I add some missing
> thread safety markers and improve the documentation related to them.
> This change will let you compile some code that would currently fail to
> compile even though it doesn't actually violate any thread safety rules.
>
> You can find a definition of what these marker traits mean at [1].
>
> Changes since v2:
>
>  * Removed "for example" as suggested in [2].
>  * Added Reviewed-by annotations from v2 review.
>
> [1]: https://stackoverflow.com/a/68708557/1704411
> [2]: https://lore.kernel.org/all/20230523165027.71600b4b.gary@garyguo.net/

Applied to `rust-next` -- thanks everyone (and Alice for taking the
effort to send this v3 even for the small change)!

Cheers,
Miguel