I'm testing some code using loom, which (among other things) accesses a lazy_static value in a Drop impl. It appears that loom's simulated lazy_static...doesn't like this:
thread 'main' panicked at 'attempted to access lazy_static during shutdown', /home/eliza/.cargo/registry/src/github.com-1ecc6299db9ec823/loom-0.3.6/src/rt/lazy_static.rs:45:14
It would be nice if this could be supported. IIRC, I think loom's thread-locals have a similar issue, but I might be misremembering.
Is it possible to, for example, ensure that the lazy_static's execution state is dropped after any values constructed during the test that might touch it?
In this particular case, it's somewhat important that loom's lazy static be used in the test, as using a "real" lazy static results in non-deterministic behavior, hitting an internal loom assertion elsewhere.
I'm testing some code using
loom
, which (among other things) accesses alazy_static
value in aDrop
impl. It appears thatloom
's simulatedlazy_static
...doesn't like this:It would be nice if this could be supported. IIRC, I think loom's thread-locals have a similar issue, but I might be misremembering.
Is it possible to, for example, ensure that the lazy_static's execution state is dropped after any values constructed during the test that might touch it?