mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-24 22:32:56 +02:00
Add note about !Sync (#2138)
This is key to the validity of how Cell and RefCell allow safe interior mutability.
This commit is contained in:
parent
c45b291851
commit
26e1d77b3e
@ -71,4 +71,8 @@ that safety, and `RefCell` and `Cell` are two of them.
|
||||
`&self`. This needs no runtime check, but requires moving values, which can
|
||||
have its own cost.
|
||||
|
||||
- Both `RefCell` and `Cell` are `!Sync`, which means `&RefCell` and `&Cell`
|
||||
can't be passed between threads. This prevents two threads trying to access
|
||||
the cell at once.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user