Big release with a huge number of changes.
Much faster DynamicRootSet that does not require individual allocations per
root!
Non-object-safe Collect trait enables more optimization for automatic impls.
Explicit forward and backwards GC write barriers to enable more kinds of safe
container abstractions.
More precise control over GC phase.
Entirely new, much more tunable, much more correct GC pacing system.
Removes the idea of "external allocation" from collection entirely, as it was
simply too complex to reason about. Instead, users can use custom allocators
and directly adjust collection debt up and down based on recorded external
allocation. This direct adjustment of collection debt can also be use to
directly drive incremental collection independent of GC allocation.
Release Highlights
- Implement
Ord/PartialOrdforCollectionPhase. - Let
Gc::cast,Gc::from_ptrGcWeak::castandGcWeak::from_ptrwork with
unsized types. - Redesign
DynamicRootSetto not require individual allocations per root. - Remove
Collect,Sized, and'staticbounds onRootable::Root. - Add convenience
Gc::new_static,Gc::eraseandGcWeak::eraseconvenience
methods. - Make
StaticCollect<T>work with unsizedT. - Add (unsafe) forward write barriers and explicit (unsafe) backwards write
barriers toMutation. - Rename
CollectionPhase::Collecting->CollectionPhase::Sweepingand
StaticCollect->Static. - Get rid of
unsafe_empty_collect!macro. - Slightly re-org crate exports and drop some special case re-exports from the
crate root. - Rename
MarkedArena::start_collectingtoMarkedArena::start_sweepingto
matchCollectionPhase::Sweeping - Implement
Borrow<T>forGc<'gc, T>. - Rework the
Collecttrait. Adds a'gclifetime for correctness.
Collect::NEEDS_TRACEassociated constant allows for more optimization
of tracing. No longer object safe! Adds aTracetrait for the trace
implementation passed toCollect::trace. - Use unsafe interior mutability to reduce internal
RefCelllocking in the
collector. - Update
hashbrownto0.17. - New, much more correct GC pacing system with many more tunable parameters.
- Add
Arena::cycle_debt(equivalent ofArena::collect_debtwhich stops at
the end of the GC cycle. and some method renames to aid phase tracking. - Add the ability to add / subtract artificial debt from the GC pacing.
- Improvements to correctness around inheriting GC debt across cycles.
- Implement
CollectforBinaryHeap. - Add
OnceLock(a GC-awareOnceCell). - Add
{Deref, Index}Writetraits, for deref. and indexing behind write
barriers. - Migrate to Edition 2024 to fix
field!macro unsoundness. - Add a
DynCollecttrait and a way to safely GC custom dyn traits via a macro
(replacement for lostCollectobject safety). - Add
Collectimpl forenum_map::EnumMapbehind feature gate. - Add
Collectimpl forslotmap::SlotMapbehind feature gate. - Add
Collectimpl forsmallvec::SmallVecbehind feature gate. Collectimpl forindexmap::IndexMapandindexmap::IndexSetbehind
feature gate.- Remove all notions of externally allocated bytes,
MetricsAlloc, and
allocator-api2dependency.