You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/trpl/concurrency.md
+5-6
Original file line number
Diff line number
Diff line change
@@ -40,14 +40,14 @@ us enforce that it can't leave the current thread.
40
40
41
41
### `Sync`
42
42
43
-
The second of these two trait is called [`Sync`](../std/marker/trait.Sync.html).
43
+
The second of these traits is called [`Sync`](../std/marker/trait.Sync.html).
44
44
When a type `T` implements `Sync`, it indicates to the compiler that something
45
45
of this type has no possibility of introducing memory unsafety when used from
46
46
multiple threads concurrently.
47
47
48
48
For example, sharing immutable data with an atomic reference count is
49
49
threadsafe. Rust provides a type like this, `Arc<T>`, and it implements `Sync`,
50
-
so that it could be safely shared between threads.
50
+
so it is safe to share between threads.
51
51
52
52
These two traits allow you to use the type system to make strong guarantees
53
53
about the properties of your code under concurrency. Before we demonstrate
@@ -69,7 +69,7 @@ fn main() {
69
69
}
70
70
```
71
71
72
-
The `Thread::scoped()` method accepts a closure, which is executed in a new
72
+
The `thread::scoped()` method accepts a closure, which is executed in a new
73
73
thread. It's called `scoped` because this thread returns a join guard:
74
74
75
75
```
@@ -208,10 +208,10 @@ Here's the error:
208
208
209
209
```text
210
210
<anon>:11:9: 11:22 error: the trait `core::marker::Send` is not implemented for the type `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` [E0277]
211
-
<anon>:11 Thread::spawn(move || {
211
+
<anon>:11 thread::spawn(move || {
212
212
^~~~~~~~~~~~~
213
213
<anon>:11:9: 11:22 note: `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` cannot be sent between threads safely
214
-
<anon>:11 Thread::spawn(move || {
214
+
<anon>:11 thread::spawn(move || {
215
215
^~~~~~~~~~~~~
216
216
```
217
217
@@ -322,7 +322,6 @@ While this channel is just sending a generic signal, we can send any data that
0 commit comments