@@ -1421,19 +1421,22 @@ impl<T> FusedIterator for Iter<'_, T> {}
1421
1421
/// [`IntoIterator`]: core::iter::IntoIterator
1422
1422
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1423
1423
#[ 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 > ,
1426
1429
}
1427
1430
1428
1431
#[ 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 > {
1430
1433
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1431
1434
f. debug_tuple ( "IntoIter" ) . field ( & self . iter . as_slice ( ) ) . finish ( )
1432
1435
}
1433
1436
}
1434
1437
1435
1438
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1436
- impl < T > Iterator for IntoIter < T > {
1439
+ impl < T , A : Allocator > Iterator for IntoIter < T , A > {
1437
1440
type Item = T ;
1438
1441
1439
1442
#[ inline]
@@ -1448,29 +1451,29 @@ impl<T> Iterator for IntoIter<T> {
1448
1451
}
1449
1452
1450
1453
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1451
- impl < T > DoubleEndedIterator for IntoIter < T > {
1454
+ impl < T , A : Allocator > DoubleEndedIterator for IntoIter < T , A > {
1452
1455
#[ inline]
1453
1456
fn next_back ( & mut self ) -> Option < T > {
1454
1457
self . iter . next_back ( )
1455
1458
}
1456
1459
}
1457
1460
1458
1461
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1459
- impl < T > ExactSizeIterator for IntoIter < T > {
1462
+ impl < T , A : Allocator > ExactSizeIterator for IntoIter < T , A > {
1460
1463
fn is_empty ( & self ) -> bool {
1461
1464
self . iter . is_empty ( )
1462
1465
}
1463
1466
}
1464
1467
1465
1468
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1466
- impl < T > FusedIterator for IntoIter < T > { }
1469
+ impl < T , A : Allocator > FusedIterator for IntoIter < T , A > { }
1467
1470
1468
1471
// In addition to the SAFETY invariants of the following three unsafe traits
1469
1472
// also refer to the vec::in_place_collect module documentation to get an overview
1470
1473
#[ unstable( issue = "none" , feature = "inplace_iteration" ) ]
1471
1474
#[ 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 > ;
1474
1477
1475
1478
#[ inline]
1476
1479
unsafe fn as_inner ( & mut self ) -> & mut Self :: Source {
@@ -1480,9 +1483,9 @@ unsafe impl<T> SourceIter for IntoIter<T> {
1480
1483
1481
1484
#[ unstable( issue = "none" , feature = "inplace_iteration" ) ]
1482
1485
#[ doc( hidden) ]
1483
- unsafe impl < I > InPlaceIterable for IntoIter < I > { }
1486
+ unsafe impl < I , A : Allocator > InPlaceIterable for IntoIter < I , A > { }
1484
1487
1485
- unsafe impl < I > AsVecIntoIter for IntoIter < I > {
1488
+ unsafe impl < I > AsVecIntoIter for IntoIter < I , Global > {
1486
1489
type Item = I ;
1487
1490
1488
1491
fn as_into_iter ( & mut self ) -> & mut vec:: IntoIter < Self :: Item > {
@@ -1682,9 +1685,9 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
1682
1685
}
1683
1686
1684
1687
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1685
- impl < T > IntoIterator for BinaryHeap < T > {
1688
+ impl < T , A : Allocator > IntoIterator for BinaryHeap < T , A > {
1686
1689
type Item = T ;
1687
- type IntoIter = IntoIter < T > ;
1690
+ type IntoIter = IntoIter < T , A > ;
1688
1691
1689
1692
/// Creates a consuming iterator, that is, one that moves each value out of
1690
1693
/// the binary heap in arbitrary order. The binary heap cannot be used
@@ -1704,7 +1707,7 @@ impl<T> IntoIterator for BinaryHeap<T> {
1704
1707
/// println!("{x}");
1705
1708
/// }
1706
1709
/// ```
1707
- fn into_iter ( self ) -> IntoIter < T > {
1710
+ fn into_iter ( self ) -> IntoIter < T , A > {
1708
1711
IntoIter { iter : self . data . into_iter ( ) }
1709
1712
}
1710
1713
}
@@ -1720,7 +1723,7 @@ impl<'a, T, A: Allocator + 'a> IntoIterator for &'a BinaryHeap<T, A> {
1720
1723
}
1721
1724
1722
1725
#[ 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 > {
1724
1727
#[ inline]
1725
1728
fn extend < I : IntoIterator < Item = T > > ( & mut self , iter : I ) {
1726
1729
<Self as SpecExtend < I > >:: spec_extend ( self , iter) ;
@@ -1737,7 +1740,7 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
1737
1740
}
1738
1741
}
1739
1742
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 > {
1741
1744
default fn spec_extend ( & mut self , iter : I ) {
1742
1745
self . extend_desugared ( iter. into_iter ( ) ) ;
1743
1746
}
0 commit comments