1
Fork 0

Rename Share to Sync

This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use`
statement, but the `NoShare` struct is no longer part of `std::kinds::marker`
due to #12660 (the build cannot bootstrap otherwise).

All code referencing the `Share` trait should now reference the `Sync` trait,
and all code referencing the `NoShare` type should now reference the `NoSync`
type. The functionality and meaning of this trait have not changed, only the
naming.

Closes #16281
[breaking-change]
This commit is contained in:
Alex Crichton 2014-08-05 16:40:04 -07:00
parent b09a02b415
commit 1f760d5d1a
59 changed files with 199 additions and 190 deletions

View file

@ -50,15 +50,15 @@ non-deterministic behavior. Rust provides the tools to make using a GC
possible and even pleasant, but it should not be a requirement for
implementing the language.
## Non-`Share` `static mut` is unsafe
## Non-`Sync` `static mut` is unsafe
Types which are [`Share`][share] are thread-safe when multiple shared
references to them are used concurrently. Types which are not `Share` are not
Types which are [`Sync`][sync] are thread-safe when multiple shared
references to them are used concurrently. Types which are not `Sync` are not
thread-safe, and thus when used in a global require unsafe code to use.
[share]: http://doc.rust-lang.org/core/kinds/trait.Share.html
[sync]: http://doc.rust-lang.org/core/kinds/trait.Sync.html
### If mutable static items that implement `Share` are safe, why is taking &mut SHARABLE unsafe?
### If mutable static items that implement `Sync` are safe, why is taking &mut SHARABLE unsafe?
Having multiple aliasing `&mut T`s is never allowed. Due to the nature of
globals, the borrow checker cannot possibly ensure that a static obeys the