109 Commits

Author SHA1 Message Date
Mark Rousskov
683a3db01f Switch to bootstrapping from 1.29 beta 2018-08-01 11:59:08 -06:00
willmo
e769deca99
Add #[repr(transparent)] to Atomic* types
This allows them to be used in #[repr(C)] structs without warnings. Since rust-lang/rfcs#1649 and rust-lang/rust#35603 they are already documented to have "the same in-memory representation as" their corresponding primitive types. This just makes that explicit.
2018-07-07 20:09:34 -07:00
Jorge Aparicio
0ed32313a2 #[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")] 2018-07-05 16:52:46 -05:00
Jorge Aparicio
bbf688a84d enable Atomic*.{load,store} for ARMv6-M / MSP430
closes #45085

this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]`
attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS
natively, like MSP430 and ARMv6-M.
2018-07-05 16:44:29 -05:00
bors
230b97af1c Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton
atomic: remove 'Atomic*' from Debug output

For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.
2018-04-19 23:08:16 +00:00
bors
532764cb79 Auto merge of #49963 - llogiq:stabilize-13226, r=kennytm
stabilize fetch_nand

This closes #13226 and makes `Atomic*.fetch_nand` stable.
2018-04-16 07:44:25 +00:00
Andre Bogus
c68c90a232 stabilize fetch_nand 2018-04-14 15:51:31 +02:00
Andre Bogus
2f603413ab improve Atomic*::fetch_update docs 2018-04-12 22:48:48 +02:00
kennytm
920249abdd
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm
Add a generic CAS loop to std::sync::Atomic*

This adds two new methods to both `AtomicIsize` and `AtomicUsize` with optimized safe compare-and-set loops, so users will no longer need to write their own, except in *very* strange circumstances.

`update_and_fetch` will apply the function and return its result, whereas `fetch_and_update` will apply the function and return the previous value.

This solves #48384 with `x.update_and_fetch(|x| x.max(y))`. It also relates to #48655 (which I misuse as tracking issue for now)..

*note* This *might* need a crater run because the functions could clash with third party extension traits.
2018-04-05 16:51:16 +08:00
Andre Bogus
0f5e419163 Add a generic CAS loop to std::sync::Atomic*
This adds a new method to all numeric `Atomic*` types with a
safe compare-and-set loop, so users will no longer need to write
their own, except in *very* strange circumstances.

This solves #48384 with `x.fetch_max(_)`/`x.fetch_min(_)`. It
also relates to #48655 (which I misuse as tracking issue for now).

*note* This *might* need a crater run because the functions could
clash with third party extension traits.
2018-03-30 12:27:14 +02:00
Tim Neumann
9e4d5cf0ce
Rollup merge of #49170 - steveklabnik:gh49127, r=nagisa
Clarify AcqRel's docs

This implied things that are not true.

Fixes #49127
2018-03-26 15:14:57 +02:00
Steve Klabnik
23013c791c
update wording as per feedback 2018-03-25 14:19:27 +02:00
Guillaume Gomez
2b64799365 Make Atomic doc examples specific to each type 2018-03-19 21:43:45 +01:00
steveklabnik
deae8de673 Clarify AcqRel's docs
This implied things that are not true.

Fixes #49127
2018-03-19 14:34:51 +01:00
Sean McArthur
c689db2c46 atomic: remove 'Atomic*' from Debug output 2018-02-26 11:35:36 -08:00
Stefan Schindler
e812da0ed0 Force the link to std:🧵:yield_now() 2018-02-16 12:20:54 +01:00
Stefan Schindler
3bf989f4c9 Add link to yield_now 2018-02-16 10:30:31 +01:00
Mark Simulacrum
1335b3da5a Add fetch_nand.
cc #13226 (the tracking issue)
2018-02-09 16:04:41 -07:00
bors
21882aad72 Auto merge of #47204 - varkor:unsafecell-into_inner-safe, r=alexcrichton
Make UnsafeCell::into_inner safe

This fixes #35067. It will require a Crater run as discussed in that
issue.
2018-01-28 19:01:51 +00:00
varkor
4829d502cc Make UnsafeCell::into_inner safe
This fixes #35067. It will require a Crater run as discussed in that
issue.
2018-01-05 01:11:20 +00:00
Oliver Middleton
a8d107be25 Correct a few stability attributes 2017-12-27 14:11:05 +00:00
varkor
e4dc11d98d Add std::fmt::Pointer implementation for AtomicPtr
Resolves #29212.
2017-12-10 23:21:26 +00:00
kennytm
fc9abbd7b7 Rollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushi
impl From<bool> for AtomicBool

This seems like an obvious omission from #45610. ~~I've used the same feature name and version in the hope that this can be backported to beta so it's stabilized with the other impls. If it can't be I'll change it to `1.24.0`.~~
2017-11-29 18:37:50 +08:00
kennytm
0e78c29bea Rollup merge of #46287 - SimonSapin:stable-constness, r=aturon
Stabilize const-calling existing const-fns in std

Fixes #46038
2017-11-29 18:37:47 +08:00
Oliver Middleton
71d766bd55
Change version number for impl From<bool> for AtomicBool to 1.24.0 2017-11-27 21:26:19 +00:00
Stjepan Glavina
d5e8b61054 Change the stabilization version to 1.24.0 2017-11-27 19:24:13 +01:00
Oliver Middleton
652a4bd26c impl From<bool> for AtomicBool 2017-11-27 01:23:04 +00:00
Simon Sapin
6c5f53e65e Stabilize const-calling existing const-fns in std
Fixes #46038
2017-11-26 23:43:44 +01:00
Stjepan Glavina
6ceb5f4bec Stabilize spin_loop_hint 2017-11-22 00:00:01 +01:00
Jorge Aparicio
47ed4738d9 fix core for targets with max-atomic-width = 0
closes #45802
2017-11-09 00:20:55 +01:00
M Farkas-Dyck
be21779072 since = "1.23.0" 2017-10-31 11:15:10 -08:00
M Farkas-Dyck
80a3191215 feature = "atomic_from" 2017-10-29 14:41:03 -08:00
M Farkas-Dyck
5c21637f9a impl From<T> for AtomicT 2017-10-29 01:28:54 -08:00
Alex Crichton
ca18537197 Bump to 1.23 and update bootstrap
This commit updates the bootstrap compiler, bumps the version to 1.23, updates
Cargo, updates books, and updates crates.io dependencies
2017-10-26 13:59:18 -07:00
Guillaume Gomez
98045fdaca Add missing links for AtomicBool 2017-10-05 23:20:58 +02:00
Mark Simulacrum
7756d39dca Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik
docs improvement sync::atomic::Atomic*

Addresses the `Atomic*` part of #29377.
r? @steveklabnik
2017-09-29 17:59:02 -06:00
Lucas Morales
f7fd04ae65
docs improvement sync::atomic::Atomic* 2017-09-25 19:39:52 -04:00
David Tolnay
874124b2c7
Backport libs stabilizations to 1.21 beta
This includes the following stabilizations:

- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640
2017-09-24 22:27:39 -07:00
Michal Budzynski
5f62c0c864 Added more text from unstable-book to compiler_fence docs 2017-09-16 22:18:46 +02:00
Michal Budzynski
9a60bb077c Added example to compiler_fence docs taken from unstable-book 2017-09-16 22:18:46 +02:00
Michal Budzynski
8a11172d6b stabilized compiler_fences (fixes #41091) 2017-09-16 22:18:46 +02:00
Alex Burka
681e5da61e change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
Fourchaux
c7104be1a3 Fix typos & us spellings 2017-08-15 21:56:30 +02:00
Jorge Aparicio
e4f9db7b8f core: fix unused_macro warning
when compiling the crate for a target with max-atomic-width = 0

fixes #42097
2017-05-18 23:33:08 -05:00
Corey Farwell
1a5284c32b Rollup merge of #41217 - topecongiro:docs/atomic-fence, r=steveklabnik
Update docs of 'fence'

This PR updates the docs for `std::sync::atomic::fence` with an example and a diagram.
Part of #29377.
r? @steveklabnik
2017-05-02 21:21:17 -04:00
Steven Stewart-Gallus
f4fe3cd0e9 Added spin loop pause function 2017-05-01 17:11:44 -07:00
topecongiro
91a9866bb3 Add an example for 'fence' 2017-05-01 17:25:07 +09:00
Jon Gjengset
368d56010a
Rename compiler_barrier to compiler_fence
This addresses concerns raised following the merge of #41092.
Specifically:

> The naming of these seems surprising: the multithreaded functions (and
> both the single and multithreaded intrinsics themselves) are fences,
> but this is a barrier. It's not incorrect, but the latter is both
> inconsistent with the existing functions and slightly confusing with
> another type in std (e.g., `Barrier`).

`compiler_fence` carries the same semantic implication that this is a
compiler-only operation, while being more in line with the fence/barrier
concepts already in use in `std`.
2017-04-13 10:27:52 -04:00
bors
b2d9b6323e Auto merge of #41092 - jonhoo:std-fence-intrinsics, r=alexcrichton
Add safe wrapper for atomic_compilerfence intrinsics

This PR adds a proposed safe wrapper for the `atomic_singlethreadfence_*` intrinsics introduced by [RFC #888](https://github.com/rust-lang/rfcs/pull/888). See #41091 for further discussion.
2017-04-08 22:37:35 +00:00
Stjepan Glavina
f7ffe5bd24 Replace compare_exchange with swap 2017-04-07 18:04:15 +02:00