Question about Sync and Send types

Blandy incorporates the following diagram in his Programming Rust book:

Based on the diagram above, it seems that all types that impl Sync also impl Send. However, the MutexGuard type seems to defy this sort of assertion given that that we see !Send: MutexGuard in std::sync - Rust'_,+T%3E

Can someone please confirm?

The diagram is misleading. Sync does not imply Send, as you note for MutexGuard. There are other examples where you might want this (e.g. OpenSHMEM in funneled mode).

You may find value in this overview of the relationship between Send and Sync.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.