Closed
Description
I have a regex that I only want to initialize once, which is why I wrapped it in a lazy_static
. However when using the unstable lazy
api (see #74465) instead, sharing it between threads causes the initialization function to run every time.
Note that if static
is used rather than const
, it (correctly) fails to compile as it's not Sync
.
const SyncLazy
has the same issue, but not static SyncLazy
, which is the correct thing to use here.
Metadata
Metadata
Assignees
Labels
No labels