Skip to content

Commit 5b2d690

Browse files
committed
Send and Sync
1 parent 14b9019 commit 5b2d690

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

text/0000-unsafe-aliased.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ Adding something like this to Rust has been discussed many times throughout the
424424
- Should this type `derive(Copy)`? `UnsafeCell` does not, which is unfortunate because it now means some people might use `T: Copy` as indication that there is no `UnsafeCell` in `T`.
425425
- `Unpin` [also affects the `dereferenceable` attribute](https://github.com/rust-lang/rust/pull/106180), so the same would happen for this type. Is that something we want to guarantee, or do we hope to get back `dereferenceable` when better semantics for it materialize on the LLVM side?
426426
- When should `UnsafePinned<T>` be `Send` or `Sync`?
427-
Self-referential futures can be `Send` because once they are pinned, they cannot be moved, so certainly they cannot be sent -- in other words, `Send` only constrains the unpinned state of a type.
427+
`UnsafeCell` is `Send` but not `Sync` because of its interaction with shared references.
428+
The corresponding choice for `UnsafePinned` would be to make it `Sync` but not `Send`, but that seems like an odd choice.
429+
Given that `SyncUnsafeCell` was eventually proposed because the `!Sync` bound on `UnsafeCell` turned out to be too safe of a default for some cases, it may make sense to do the same with `UnsafePinned` and just have it inherit both `Send` and `Sync`.
428430

429431
# Future possibilities
430432
[future-possibilities]: #future-possibilities

0 commit comments

Comments
 (0)