Skip to content

Commit 24df5f2

Browse files
committed
Parametrize a few more things
1 parent d48b281 commit 24df5f2

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

library/alloc/src/collections/binary_heap.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -1421,19 +1421,22 @@ impl<T> FusedIterator for Iter<'_, T> {}
14211421
/// [`IntoIterator`]: core::iter::IntoIterator
14221422
#[stable(feature = "rust1", since = "1.0.0")]
14231423
#[derive(Clone)]
1424-
pub struct IntoIter<T> {
1425-
iter: vec::IntoIter<T>,
1424+
pub struct IntoIter<
1425+
T,
1426+
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
1427+
> {
1428+
iter: vec::IntoIter<T, A>,
14261429
}
14271430

14281431
#[stable(feature = "collection_debug", since = "1.17.0")]
1429-
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
1432+
impl<T: fmt::Debug, A: Allocator> fmt::Debug for IntoIter<T, A> {
14301433
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14311434
f.debug_tuple("IntoIter").field(&self.iter.as_slice()).finish()
14321435
}
14331436
}
14341437

14351438
#[stable(feature = "rust1", since = "1.0.0")]
1436-
impl<T> Iterator for IntoIter<T> {
1439+
impl<T, A: Allocator> Iterator for IntoIter<T, A> {
14371440
type Item = T;
14381441

14391442
#[inline]
@@ -1448,29 +1451,29 @@ impl<T> Iterator for IntoIter<T> {
14481451
}
14491452

14501453
#[stable(feature = "rust1", since = "1.0.0")]
1451-
impl<T> DoubleEndedIterator for IntoIter<T> {
1454+
impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
14521455
#[inline]
14531456
fn next_back(&mut self) -> Option<T> {
14541457
self.iter.next_back()
14551458
}
14561459
}
14571460

14581461
#[stable(feature = "rust1", since = "1.0.0")]
1459-
impl<T> ExactSizeIterator for IntoIter<T> {
1462+
impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A> {
14601463
fn is_empty(&self) -> bool {
14611464
self.iter.is_empty()
14621465
}
14631466
}
14641467

14651468
#[stable(feature = "fused", since = "1.26.0")]
1466-
impl<T> FusedIterator for IntoIter<T> {}
1469+
impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {}
14671470

14681471
// In addition to the SAFETY invariants of the following three unsafe traits
14691472
// also refer to the vec::in_place_collect module documentation to get an overview
14701473
#[unstable(issue = "none", feature = "inplace_iteration")]
14711474
#[doc(hidden)]
1472-
unsafe impl<T> SourceIter for IntoIter<T> {
1473-
type Source = IntoIter<T>;
1475+
unsafe impl<T, A: Allocator> SourceIter for IntoIter<T, A> {
1476+
type Source = IntoIter<T, A>;
14741477

14751478
#[inline]
14761479
unsafe fn as_inner(&mut self) -> &mut Self::Source {
@@ -1480,9 +1483,9 @@ unsafe impl<T> SourceIter for IntoIter<T> {
14801483

14811484
#[unstable(issue = "none", feature = "inplace_iteration")]
14821485
#[doc(hidden)]
1483-
unsafe impl<I> InPlaceIterable for IntoIter<I> {}
1486+
unsafe impl<I, A: Allocator> InPlaceIterable for IntoIter<I, A> {}
14841487

1485-
unsafe impl<I> AsVecIntoIter for IntoIter<I> {
1488+
unsafe impl<I> AsVecIntoIter for IntoIter<I, Global> {
14861489
type Item = I;
14871490

14881491
fn as_into_iter(&mut self) -> &mut vec::IntoIter<Self::Item> {
@@ -1682,9 +1685,9 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
16821685
}
16831686

16841687
#[stable(feature = "rust1", since = "1.0.0")]
1685-
impl<T> IntoIterator for BinaryHeap<T> {
1688+
impl<T, A: Allocator> IntoIterator for BinaryHeap<T, A> {
16861689
type Item = T;
1687-
type IntoIter = IntoIter<T>;
1690+
type IntoIter = IntoIter<T, A>;
16881691

16891692
/// Creates a consuming iterator, that is, one that moves each value out of
16901693
/// the binary heap in arbitrary order. The binary heap cannot be used
@@ -1704,7 +1707,7 @@ impl<T> IntoIterator for BinaryHeap<T> {
17041707
/// println!("{x}");
17051708
/// }
17061709
/// ```
1707-
fn into_iter(self) -> IntoIter<T> {
1710+
fn into_iter(self) -> IntoIter<T, A> {
17081711
IntoIter { iter: self.data.into_iter() }
17091712
}
17101713
}
@@ -1720,7 +1723,7 @@ impl<'a, T, A: Allocator + 'a> IntoIterator for &'a BinaryHeap<T, A> {
17201723
}
17211724

17221725
#[stable(feature = "rust1", since = "1.0.0")]
1723-
impl<T: Ord> Extend<T> for BinaryHeap<T> {
1726+
impl<T: Ord, A: Allocator> Extend<T> for BinaryHeap<T, A> {
17241727
#[inline]
17251728
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
17261729
<Self as SpecExtend<I>>::spec_extend(self, iter);
@@ -1737,7 +1740,7 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
17371740
}
17381741
}
17391742

1740-
impl<T: Ord, I: IntoIterator<Item = T>> SpecExtend<I> for BinaryHeap<T> {
1743+
impl<T: Ord, A: Allocator, I: IntoIterator<Item = T>> SpecExtend<I> for BinaryHeap<T, A> {
17411744
default fn spec_extend(&mut self, iter: I) {
17421745
self.extend_desugared(iter.into_iter());
17431746
}

0 commit comments

Comments
 (0)