]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #98383 - m-ou-se:remove-memory-order-restrictions, r=joshtriplett
authorYuki Okushi <jtitor@2k36.org>
Sun, 17 Jul 2022 23:39:57 +0000 (08:39 +0900)
committerGitHub <noreply@github.com>
Sun, 17 Jul 2022 23:39:57 +0000 (08:39 +0900)
commit796bc7cae364b39ff7e5139842b51dd9b764060d
treece79b2e9250d96491caa4a01bf0b217d60a234a4
parent263edd43c5255084292329423c61a9d69715ebfa
parenta898f413795d923d1a025517458fa0fd2d7291ac
Rollup merge of #98383 - m-ou-se:remove-memory-order-restrictions, r=joshtriplett

Remove restrictions on compare-exchange memory ordering.

We currently don't allow the failure memory ordering of compare-exchange operations to be stronger than the success ordering, as was the case in C++11 when its memory model was copied to Rust. However, this restriction was lifted in C++17 as part of [p0418r2](https://wg21.link/p0418r2). It's time  we lift the restriction too.

| Success | Failure | Before | After |
|---------|---------|--------|-------|
| Relaxed | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Relaxed | Acquire | :x:                | :heavy_check_mark: |
| Relaxed | SeqCst  | :x:                | :heavy_check_mark: |
| Acquire | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Acquire | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| Acquire | SeqCst  | :x:                | :heavy_check_mark: |
| Release | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Release | Acquire | :x:                | :heavy_check_mark: |
| Release | SeqCst  | :x:                | :heavy_check_mark: |
| AcqRel  | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| AcqRel  | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| AcqRel  | SeqCst  | :x:                | :heavy_check_mark: |
| SeqCst  | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| SeqCst  | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| SeqCst  | SeqCst  | :heavy_check_mark: | :heavy_check_mark: |
| \*      | Release | :x:                | :x:                |
| \*      | AcqRel  | :x:                | :x:                |

Fixes https://github.com/rust-lang/rust/issues/68464
library/core/src/sync/atomic.rs