Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the
lazy_static!
macro from thelazy_static
crate. We needto re-implement it both since it establishes causality (through its use
of
Once
), and because the state needs to be cleared on everyexecution. This implementation does that.
One unfortunate downside of this implementation is that it is inherently
unsafe. Specifically, in the context of loom, statics are, well, not
static. And yet the API of
lazy_static!
is such that it gives out'static
references. We cannot safely give out'static
refs intostatics that we clear on every execution.
One option here is to leak every static we allocate. The code would then
be safe (since the references would indeed be
'static
), but it wouldmean we leak all statics for every execution, no matter whether the
user needs them to be
'static
or not.Fixes #124.