Rustc validation of Ordering values in compare_exchange

⚓ Rust    📅 2026-05-08    👤 surdeus    👁️ 3      

surdeus

When I'm using AtomicBool in std::sync::atomic - Rust, rustc validates the Ordering I'm using. For example, I cannot use Release for the failure parameter.

I've looked at the types, and I don't see any thing generic being used here to validate which Ordering values are being used. Is it something built in ad-hoc in rustc? Or is it a generic validation that I've missed?
Which information is being used to emit a compilation error when Release is being used for example?

4 posts - 2 participants

Read full topic

🏷️ Rust_feed