Skip to content

Ordering::AcqRel implementation contradicts the docs #49127

Closed
@imp

Description

@imp

Documentation on Ordering::AcqRel states:

AcqRel
When coupled with a load, uses `Acquire` ordering, and with a store `Release` ordering.

However, this code

use std::sync::atomic::{AtomicBool, Ordering};

fn main() {
    let b = AtomicBool::new(false);
    b.store(true, Ordering::AcqRel);
    b.load(Ordering::AcqRel);
}

panics on both store and load (if the call to store() is commented out)

thread 'main' panicked at 'there is no such thing as an acquire/release store', /checkout/src/libcore/sync/atomic.rs:1482:19
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Either documentation should be updated to describe why this is not relevant to store/load, or implementation should be fixed to actually deliver on the promise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions