Open cmnord opened 4 years ago
This won't work because location!
from track_caller
requires some more const fn things to be stabilized.
I see, I guess my project will have to wait then. Can you recommend any workaround?
Not really aware of a work around, except for feature flagging the const aspects but that may be hard.
I'm trying to test a spinlock that uses parking_lot's
lock_api
with Loom.To implement
lock_api
'sRawRwLock
I need to supply aconst
initial value, as specified on this line. This works with the standard library'sstd::sync::atomic::AtomicUsize
const fn new
, but not with Loom'satomic_int!
macro which generates a non-constfn new
.I get the following error when running
RUSTFLAGS="--cfg loom" cargo test
, whererin
is one of the fields of the struct I initialize. It does not throw an error with regularcargo test
(usingstd::sync::atomic
).Is it possible to make
loom::sync::atomic::AtomicUsize::new
const
, or can you recommend another workaround?