2 ms·
> Rust-the-language doesn't know anything about allocations AIUI, Rust knows more about allocations than it should, since it's still limited to a single global
by zozbot234 7y ago
> Rust-the-language doesn't know anything about allocations
AIUI, Rust knows more about allocations than it should, since it's still limited to a single global allocator, and Box<> (which relies on that global allocator) is implemented via compiler magic and cannot be supplemented by equivalent library code. If Rust supported "pluggable" allocators in some fashion, fancy features (including heap compaction, although I find that a bit dubious TBH) might become easier to implement.
- Ar-Curunir 7y ago`std` data structures that are generic over type of allocator are in the works.
- shepmaster 7y ago> If Rust supported "pluggable" allocators in some fashion It's coming, but it's still unstable and being actively developed - https://github.com/rust-lang/rust/issues/32838 https://github.com/rust-lang/rust/issues/32838
- steveklabnik 7y agoGlobal allocator is a standard library concern, not a language concern, and Box is magic in only one tiny way that doesn’t actually have to do with allocation. Eventually that will be available to other libraries too.