Skip to content

Commit c886a0a

Browse files
committed
Update alternatives (UnsafeCell trick is a "bug", lazy_static uses raw pointers on stable)
1 parent 06f87fd commit c886a0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

text/0000-drop-types-in-const.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ Destructors do not run on `static` items (by design), so this can lead to unexpe
3232
# Alternatives
3333
[alternatives]: #alternatives
3434

35-
Existing workarounds are based on storing `Option<T>`, and initialising it to `Some` upon first access. These solutions work, but require runtime intialisation and incur a checking overhead on subsequent accesses.
35+
- Runtime initialisation of a raw pointer can be used instead (as the `lazy_static` crate currently does on stable)
36+
- On nightly, a bug related to `static` and `UnsafeCell<Option<T>>` can be used to remove the dynamic allocation.
37+
38+
Both of these alternatives require runtime initialisation, and incur a checking overhead on subsequent accesses.
3639

3740
# Unresolved questions
3841
[unresolved]: #unresolved-questions

0 commit comments

Comments
 (0)