forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit de1ff0a
committed
Auto merge of rust-lang#99339 - yanchith:binary-heap-ta, r=Amanieu
Make BinaryHeap parametric over Allocator
Tracking issue: rust-lang#32838
Related: rust-lang/wg-allocators#7
This parametrizes `BinaryHeap` with `A`, similarly to how other collections are parametrized.
A couple things I left out:
```
BinaryHeap::append
Currently requires both structures to have the same allocator type. Could
change, but depends on Vec::append, which has the same constraints.
impl<T: Ord> Default for BinaryHeap<T>
Not parametrized, because there's nowhere to conjure the allocator from.
impl<T: Ord> FromIterator<T> for BinaryHeap<T>
Not parametrized, because there's nowhere to conjure the allocator from.
impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T>
Not parametrized, because there's nowhere to conjure the allocator from.
unsafe impl<I> AsVecIntoIter for IntoIter<I>
AsVecIntoIter is not allocator aware, and I didn't dare change it without guidance. Is this something important?
```
I've seen very few tests for allocator_api in general, but I'd like to at least test this on some usage code in my projects before moving forward.
EDIT: Updated the list of impls and functions that are not affected by this. `BinaryHeap` no longer has a `SpecExtend` impl, and prior work made implementing `Extend` possible.File tree
1 file changed
+175
-63
lines changedFilter options
- library/alloc/src/collections/binary_heap
1 file changed
+175
-63
lines changed
0 commit comments