Skip to content

Commit 6855d3a

Browse files
committed
races.md: data race -> race condition to violate memory safety
The first example shows that you "can't violate memory safety with safe Rust" and the second example shows that you "can violate memory safety with unsafe Rust". The second example does not demonstrate a data race since there is only one thread touching `data`.
1 parent 0674321 commit 6855d3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/races.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ thread::spawn(move || {
6060
println!("{}", data[idx.load(Ordering::SeqCst)]);
6161
```
6262

63-
We can cause a data race if we instead do the bound check in advance, and then
64-
unsafely access the data with an unchecked value:
63+
We can cause a race condition to violate memory safety if we instead do the bound
64+
check in advance, and then unsafely access the data with an unchecked value:
6565

6666
```rust,no_run
6767
use std::thread;

0 commit comments

Comments
 (0)