You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we implemented new like bumpalo using their EMPTY_CHUNK trick, we could make it const in nightly with #![feature(const_refs_to_static)].
The thing is that we have a doubly linked list of chunks instead of singly linked list. This is so we can reuse and don't have to deallocate chunks that were allocated in a scope.
We would have to check every time we create a new scope or checkpoint if we are pointing to that EMPTY_CHUNK and if so allocate a real chunk that we can mutate and link up with future chunks.
Bump allocators can now be constructed without allocation via Bump::unallocated. This only works with the Global allocator.
It's const when the feature nightly-const-refs-to-static is enabled.
An unallocated bump allocator can't create scopes or checkpoints, but everything else works.
You can use scopes by converting it into a guaranteed allocated bump allocator with into_guaranteed_allocated or as_guaranteed_allocated(_mut).
Making Bump::new be const fn allows for use in thread locals via
This makes thread local access much faster because we do not need to perform a dynamic check for each access to the thread local.
The text was updated successfully, but these errors were encountered: