@@ -1045,9 +1045,10 @@ impl<T> [T] {
1045
1045
/// assert_eq!(iterator.next(), None);
1046
1046
/// ```
1047
1047
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1048
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1048
1049
#[ inline]
1049
1050
#[ cfg_attr( not( test) , rustc_diagnostic_item = "slice_iter" ) ]
1050
- pub fn iter ( & self ) -> Iter < ' _ , T > {
1051
+ pub const fn iter ( & self ) -> Iter < ' _ , T > {
1051
1052
Iter :: new ( self )
1052
1053
}
1053
1054
@@ -1064,9 +1065,10 @@ impl<T> [T] {
1064
1065
/// }
1065
1066
/// assert_eq!(x, &[3, 4, 6]);
1066
1067
/// ```
1068
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1067
1069
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1068
1070
#[ inline]
1069
- pub fn iter_mut ( & mut self ) -> IterMut < ' _ , T > {
1071
+ pub const fn iter_mut ( & mut self ) -> IterMut < ' _ , T > {
1070
1072
IterMut :: new ( self )
1071
1073
}
1072
1074
@@ -1118,9 +1120,10 @@ impl<T> [T] {
1118
1120
/// assert_eq!(array, ['s', 't', ' ', '2', '0', '1', '5', 'u', 'R']);
1119
1121
/// ```
1120
1122
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1123
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1121
1124
#[ inline]
1122
1125
#[ track_caller]
1123
- pub fn windows ( & self , size : usize ) -> Windows < ' _ , T > {
1126
+ pub const fn windows ( & self , size : usize ) -> Windows < ' _ , T > {
1124
1127
let size = NonZero :: new ( size) . expect ( "window size must be non-zero" ) ;
1125
1128
Windows :: new ( self , size)
1126
1129
}
@@ -1153,9 +1156,10 @@ impl<T> [T] {
1153
1156
/// [`chunks_exact`]: slice::chunks_exact
1154
1157
/// [`rchunks`]: slice::rchunks
1155
1158
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1159
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1156
1160
#[ inline]
1157
1161
#[ track_caller]
1158
- pub fn chunks ( & self , chunk_size : usize ) -> Chunks < ' _ , T > {
1162
+ pub const fn chunks ( & self , chunk_size : usize ) -> Chunks < ' _ , T > {
1159
1163
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1160
1164
Chunks :: new ( self , chunk_size)
1161
1165
}
@@ -1192,9 +1196,10 @@ impl<T> [T] {
1192
1196
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
1193
1197
/// [`rchunks_mut`]: slice::rchunks_mut
1194
1198
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1199
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1195
1200
#[ inline]
1196
1201
#[ track_caller]
1197
- pub fn chunks_mut ( & mut self , chunk_size : usize ) -> ChunksMut < ' _ , T > {
1202
+ pub const fn chunks_mut ( & mut self , chunk_size : usize ) -> ChunksMut < ' _ , T > {
1198
1203
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1199
1204
ChunksMut :: new ( self , chunk_size)
1200
1205
}
@@ -1230,9 +1235,10 @@ impl<T> [T] {
1230
1235
/// [`chunks`]: slice::chunks
1231
1236
/// [`rchunks_exact`]: slice::rchunks_exact
1232
1237
#[ stable( feature = "chunks_exact" , since = "1.31.0" ) ]
1238
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1233
1239
#[ inline]
1234
1240
#[ track_caller]
1235
- pub fn chunks_exact ( & self , chunk_size : usize ) -> ChunksExact < ' _ , T > {
1241
+ pub const fn chunks_exact ( & self , chunk_size : usize ) -> ChunksExact < ' _ , T > {
1236
1242
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1237
1243
ChunksExact :: new ( self , chunk_size)
1238
1244
}
@@ -1273,9 +1279,10 @@ impl<T> [T] {
1273
1279
/// [`chunks_mut`]: slice::chunks_mut
1274
1280
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
1275
1281
#[ stable( feature = "chunks_exact" , since = "1.31.0" ) ]
1282
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1276
1283
#[ inline]
1277
1284
#[ track_caller]
1278
- pub fn chunks_exact_mut ( & mut self , chunk_size : usize ) -> ChunksExactMut < ' _ , T > {
1285
+ pub const fn chunks_exact_mut ( & mut self , chunk_size : usize ) -> ChunksExactMut < ' _ , T > {
1279
1286
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1280
1287
ChunksExactMut :: new ( self , chunk_size)
1281
1288
}
@@ -1431,9 +1438,10 @@ impl<T> [T] {
1431
1438
///
1432
1439
/// [`chunks_exact`]: slice::chunks_exact
1433
1440
#[ unstable( feature = "array_chunks" , issue = "74985" ) ]
1441
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1434
1442
#[ inline]
1435
1443
#[ track_caller]
1436
- pub fn array_chunks < const N : usize > ( & self ) -> ArrayChunks < ' _ , T , N > {
1444
+ pub const fn array_chunks < const N : usize > ( & self ) -> ArrayChunks < ' _ , T , N > {
1437
1445
assert ! ( N != 0 , "chunk size must be non-zero" ) ;
1438
1446
ArrayChunks :: new ( self )
1439
1447
}
@@ -1594,9 +1602,10 @@ impl<T> [T] {
1594
1602
///
1595
1603
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
1596
1604
#[ unstable( feature = "array_chunks" , issue = "74985" ) ]
1605
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1597
1606
#[ inline]
1598
1607
#[ track_caller]
1599
- pub fn array_chunks_mut < const N : usize > ( & mut self ) -> ArrayChunksMut < ' _ , T , N > {
1608
+ pub const fn array_chunks_mut < const N : usize > ( & mut self ) -> ArrayChunksMut < ' _ , T , N > {
1600
1609
assert ! ( N != 0 , "chunk size must be non-zero" ) ;
1601
1610
ArrayChunksMut :: new ( self )
1602
1611
}
@@ -1627,9 +1636,10 @@ impl<T> [T] {
1627
1636
///
1628
1637
/// [`windows`]: slice::windows
1629
1638
#[ unstable( feature = "array_windows" , issue = "75027" ) ]
1639
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1630
1640
#[ inline]
1631
1641
#[ track_caller]
1632
- pub fn array_windows < const N : usize > ( & self ) -> ArrayWindows < ' _ , T , N > {
1642
+ pub const fn array_windows < const N : usize > ( & self ) -> ArrayWindows < ' _ , T , N > {
1633
1643
assert ! ( N != 0 , "window size must be non-zero" ) ;
1634
1644
ArrayWindows :: new ( self )
1635
1645
}
@@ -1662,9 +1672,10 @@ impl<T> [T] {
1662
1672
/// [`rchunks_exact`]: slice::rchunks_exact
1663
1673
/// [`chunks`]: slice::chunks
1664
1674
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
1675
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1665
1676
#[ inline]
1666
1677
#[ track_caller]
1667
- pub fn rchunks ( & self , chunk_size : usize ) -> RChunks < ' _ , T > {
1678
+ pub const fn rchunks ( & self , chunk_size : usize ) -> RChunks < ' _ , T > {
1668
1679
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1669
1680
RChunks :: new ( self , chunk_size)
1670
1681
}
@@ -1701,9 +1712,10 @@ impl<T> [T] {
1701
1712
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
1702
1713
/// [`chunks_mut`]: slice::chunks_mut
1703
1714
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
1715
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1704
1716
#[ inline]
1705
1717
#[ track_caller]
1706
- pub fn rchunks_mut ( & mut self , chunk_size : usize ) -> RChunksMut < ' _ , T > {
1718
+ pub const fn rchunks_mut ( & mut self , chunk_size : usize ) -> RChunksMut < ' _ , T > {
1707
1719
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1708
1720
RChunksMut :: new ( self , chunk_size)
1709
1721
}
@@ -1741,9 +1753,10 @@ impl<T> [T] {
1741
1753
/// [`rchunks`]: slice::rchunks
1742
1754
/// [`chunks_exact`]: slice::chunks_exact
1743
1755
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
1756
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1744
1757
#[ inline]
1745
1758
#[ track_caller]
1746
- pub fn rchunks_exact ( & self , chunk_size : usize ) -> RChunksExact < ' _ , T > {
1759
+ pub const fn rchunks_exact ( & self , chunk_size : usize ) -> RChunksExact < ' _ , T > {
1747
1760
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1748
1761
RChunksExact :: new ( self , chunk_size)
1749
1762
}
@@ -1785,9 +1798,10 @@ impl<T> [T] {
1785
1798
/// [`rchunks_mut`]: slice::rchunks_mut
1786
1799
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
1787
1800
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
1801
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1788
1802
#[ inline]
1789
1803
#[ track_caller]
1790
- pub fn rchunks_exact_mut ( & mut self , chunk_size : usize ) -> RChunksExactMut < ' _ , T > {
1804
+ pub const fn rchunks_exact_mut ( & mut self , chunk_size : usize ) -> RChunksExactMut < ' _ , T > {
1791
1805
assert ! ( chunk_size != 0 , "chunk size must be non-zero" ) ;
1792
1806
RChunksExactMut :: new ( self , chunk_size)
1793
1807
}
@@ -1825,8 +1839,9 @@ impl<T> [T] {
1825
1839
/// assert_eq!(iter.next(), None);
1826
1840
/// ```
1827
1841
#[ stable( feature = "slice_group_by" , since = "1.77.0" ) ]
1842
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1828
1843
#[ inline]
1829
- pub fn chunk_by < F > ( & self , pred : F ) -> ChunkBy < ' _ , T , F >
1844
+ pub const fn chunk_by < F > ( & self , pred : F ) -> ChunkBy < ' _ , T , F >
1830
1845
where
1831
1846
F : FnMut ( & T , & T ) -> bool ,
1832
1847
{
@@ -1866,8 +1881,9 @@ impl<T> [T] {
1866
1881
/// assert_eq!(iter.next(), None);
1867
1882
/// ```
1868
1883
#[ stable( feature = "slice_group_by" , since = "1.77.0" ) ]
1884
+ #[ rustc_const_unstable( feature = "const_slice_make_iter" , issue = "137737" ) ]
1869
1885
#[ inline]
1870
- pub fn chunk_by_mut < F > ( & mut self , pred : F ) -> ChunkByMut < ' _ , T , F >
1886
+ pub const fn chunk_by_mut < F > ( & mut self , pred : F ) -> ChunkByMut < ' _ , T , F >
1871
1887
where
1872
1888
F : FnMut ( & T , & T ) -> bool ,
1873
1889
{
0 commit comments