matklad / once_cell

Rust library for single assignment cells and lazy statics without macros
Apache License 2.0
1.87k stars 109 forks source link

parking_lot implementation tests fail under Miri due to compare_exchange_weak failures #186

Closed saethlin closed 2 years ago

saethlin commented 2 years ago

compare_exchange_weak is allowed to spuriously fail. By default, Miri makes most calls fail so this panics when running tests: https://github.com/matklad/once_cell/blob/2cdfc1e0a92c8e51534cd91c49f41478a61a5ab6/src/imp_pl.rs#L171

RalfJung commented 2 years ago

Looks like this code simply wants compare_exchange without the "weak", if it does not want to handle spurious failures?

matklad commented 2 years ago

Nah, that’s just a bug, it should have Err(INCOMPLETE) => (), branch

matklad commented 2 years ago

@RalfJung in case no-one has told you this yet, miri is very cool, thanks!