Skip to content

atomic::Ordering "same as LLVM's"? Seems wrong. #65282

Closed
@RalfJung

Description

@RalfJung

@jonas-schievink pointed out that our atomic::Ordering docs say

Rust's memory orderings are the same as LLVM's.

That's not really correct though... at least according to the Nomicon, we use the C11 memory model, which is different from LLVM's. The kinds of ordering that exist are the same (at least insofar as Rust exposes them), but the details of the rules around data races are different.

Code that mixes atomic and non-atomic accesses on the same location can behave differently under both models (concretely, some programs that are UB under C11 are no longer UB under LLVM). So if people interpret "same as LLVM's" too strongly, they might be mislead.

Cc @Gankra @Centril

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions