@@ -5,8 +5,8 @@ multiply alias a location in memory while mutating it. Unless these types use
5
5
synchronization to manage this access, they are absolutely not thread safe. Rust
6
6
captures this with through the ` Send ` and ` Sync ` traits.
7
7
8
- * A type is Send if it is safe to send it to another thread. A type is Sync if
9
- * it is safe to share between threads (` &T ` is Send).
8
+ * A type is Send if it is safe to send it to another thread.
9
+ * A type is Sync if it is safe to share between threads (` &T ` is Send).
10
10
11
11
Send and Sync are * very* fundamental to Rust's concurrency story. As such, a
12
12
substantial amount of special tooling exists to make them work right. First and
@@ -25,9 +25,9 @@ ever interact with are Send and Sync.
25
25
26
26
Major exceptions include:
27
27
28
- * raw pointers are neither Send nor Sync (because they have no safety guards)
29
- * ` UnsafeCell ` isn't Sync (and therefore ` Cell ` and ` RefCell ` aren't) ` Rc ` isn't
30
- * Send or Sync (because the refcount is shared and unsynchronized)
28
+ * raw pointers are neither Send nor Sync (because they have no safety guards).
29
+ * ` UnsafeCell ` isn't Sync (and therefore ` Cell ` and ` RefCell ` aren't).
30
+ * ` Rc ` isn't Send or Sync (because the refcount is shared and unsynchronized).
31
31
32
32
` Rc ` and ` UnsafeCell ` are very fundamentally not thread-safe: they enable
33
33
unsynchronized shared mutable state. However raw pointers are, strictly
@@ -71,7 +71,7 @@ possible cause trouble by being incorrectly Send or Sync.
71
71
Most uses of raw pointers should be encapsulated behind a sufficient abstraction
72
72
that Send and Sync can be derived. For instance all of Rust's standard
73
73
collections are Send and Sync (when they contain Send and Sync types) in spite
74
- of their pervasive use raw pointers to manage allocations and complex ownership.
74
+ of their pervasive use of raw pointers to manage allocations and complex ownership.
75
75
Similarly, most iterators into these collections are Send and Sync because they
76
76
largely behave like an ` & ` or ` &mut ` into the collection.
77
77
0 commit comments