Skip to content

support lazy_static access during drop #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hawkw opened this issue Oct 14, 2020 · 1 comment
Open

support lazy_static access during drop #179

hawkw opened this issue Oct 14, 2020 · 1 comment

Comments

@hawkw
Copy link
Member

hawkw commented Oct 14, 2020

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?

@hawkw
Copy link
Member Author

hawkw commented Oct 14, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant