@@ -62,6 +62,7 @@ fn size_from_ptr<T>(_: *const T) -> usize {
6262/// [`iter`]: slice::iter 
6363/// [slices]: slice 
6464#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
65+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
6566pub  struct  Iter < ' a ,  T :  ' a >  { 
6667    ptr :  NonNull < T > , 
6768    end :  * const  T ,  // If T is a ZST, this is actually ptr+len.  This encoding is picked so that 
@@ -182,6 +183,7 @@ impl<T> AsRef<[T]> for Iter<'_, T> {
182183/// [`iter_mut`]: slice::iter_mut 
183184/// [slices]: slice 
184185#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
186+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
185187pub  struct  IterMut < ' a ,  T :  ' a >  { 
186188    ptr :  NonNull < T > , 
187189    end :  * mut  T ,  // If T is a ZST, this is actually ptr+len.  This encoding is picked so that 
@@ -339,6 +341,7 @@ pub(super) trait SplitIter: DoubleEndedIterator {
339341/// [`split`]: slice::split 
340342/// [slices]: slice 
341343#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
344+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
342345pub  struct  Split < ' a ,  T :  ' a ,  P > 
343346where 
344347    P :  FnMut ( & T )  -> bool , 
@@ -469,6 +472,7 @@ impl<T, P> FusedIterator for Split<'_, T, P> where P: FnMut(&T) -> bool {}
469472/// [`split_inclusive`]: slice::split_inclusive 
470473/// [slices]: slice 
471474#[ stable( feature = "split_inclusive" ,  since = "1.51.0" ) ]  
475+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
472476pub  struct  SplitInclusive < ' a ,  T :  ' a ,  P > 
473477where 
474478    P :  FnMut ( & T )  -> bool , 
@@ -589,6 +593,7 @@ impl<T, P> FusedIterator for SplitInclusive<'_, T, P> where P: FnMut(&T) -> bool
589593/// [`split_mut`]: slice::split_mut 
590594/// [slices]: slice 
591595#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
596+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
592597pub  struct  SplitMut < ' a ,  T :  ' a ,  P > 
593598where 
594599    P :  FnMut ( & T )  -> bool , 
@@ -718,6 +723,7 @@ impl<T, P> FusedIterator for SplitMut<'_, T, P> where P: FnMut(&T) -> bool {}
718723/// [`split_inclusive_mut`]: slice::split_inclusive_mut 
719724/// [slices]: slice 
720725#[ stable( feature = "split_inclusive" ,  since = "1.51.0" ) ]  
726+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
721727pub  struct  SplitInclusiveMut < ' a ,  T :  ' a ,  P > 
722728where 
723729    P :  FnMut ( & T )  -> bool , 
@@ -841,6 +847,7 @@ impl<T, P> FusedIterator for SplitInclusiveMut<'_, T, P> where P: FnMut(&T) -> b
841847/// [`rsplit`]: slice::rsplit 
842848/// [slices]: slice 
843849#[ stable( feature = "slice_rsplit" ,  since = "1.27.0" ) ]  
850+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
844851pub  struct  RSplit < ' a ,  T :  ' a ,  P > 
845852where 
846853    P :  FnMut ( & T )  -> bool , 
@@ -937,6 +944,7 @@ impl<T, P> FusedIterator for RSplit<'_, T, P> where P: FnMut(&T) -> bool {}
937944/// [`rsplit_mut`]: slice::rsplit_mut 
938945/// [slices]: slice 
939946#[ stable( feature = "slice_rsplit" ,  since = "1.27.0" ) ]  
947+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
940948pub  struct  RSplitMut < ' a ,  T :  ' a ,  P > 
941949where 
942950    P :  FnMut ( & T )  -> bool , 
@@ -1059,6 +1067,7 @@ impl<T, I: SplitIter<Item = T>> Iterator for GenericSplitN<I> {
10591067/// [`splitn`]: slice::splitn 
10601068/// [slices]: slice 
10611069#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1070+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
10621071pub  struct  SplitN < ' a ,  T :  ' a ,  P > 
10631072where 
10641073    P :  FnMut ( & T )  -> bool , 
@@ -1099,6 +1108,7 @@ where
10991108/// [`rsplitn`]: slice::rsplitn 
11001109/// [slices]: slice 
11011110#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1111+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
11021112pub  struct  RSplitN < ' a ,  T :  ' a ,  P > 
11031113where 
11041114    P :  FnMut ( & T )  -> bool , 
@@ -1138,6 +1148,7 @@ where
11381148/// [`splitn_mut`]: slice::splitn_mut 
11391149/// [slices]: slice 
11401150#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1151+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
11411152pub  struct  SplitNMut < ' a ,  T :  ' a ,  P > 
11421153where 
11431154    P :  FnMut ( & T )  -> bool , 
@@ -1178,6 +1189,7 @@ where
11781189/// [`rsplitn_mut`]: slice::rsplitn_mut 
11791190/// [slices]: slice 
11801191#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1192+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
11811193pub  struct  RSplitNMut < ' a ,  T :  ' a ,  P > 
11821194where 
11831195    P :  FnMut ( & T )  -> bool , 
@@ -1222,6 +1234,7 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] }
12221234/// [slices]: slice 
12231235#[ derive( Debug ) ]  
12241236#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1237+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
12251238pub  struct  Windows < ' a ,  T :  ' a >  { 
12261239    v :  & ' a  [ T ] , 
12271240    size :  NonZeroUsize , 
@@ -1370,6 +1383,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for Windows<'a, T> {
13701383/// [slices]: slice 
13711384#[ derive( Debug ) ]  
13721385#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1386+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
13731387pub  struct  Chunks < ' a ,  T :  ' a >  { 
13741388    v :  & ' a  [ T ] , 
13751389    chunk_size :  usize , 
@@ -1539,6 +1553,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for Chunks<'a, T> {
15391553/// [slices]: slice 
15401554#[ derive( Debug ) ]  
15411555#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1556+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
15421557pub  struct  ChunksMut < ' a ,  T :  ' a >  { 
15431558    v :  & ' a  mut  [ T ] , 
15441559    chunk_size :  usize , 
@@ -1707,6 +1722,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for ChunksMut<'a, T> {
17071722/// [slices]: slice 
17081723#[ derive( Debug ) ]  
17091724#[ stable( feature = "chunks_exact" ,  since = "1.31.0" ) ]  
1725+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
17101726pub  struct  ChunksExact < ' a ,  T :  ' a >  { 
17111727    v :  & ' a  [ T ] , 
17121728    rem :  & ' a  [ T ] , 
@@ -1866,6 +1882,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for ChunksExact<'a, T> {
18661882/// [slices]: slice 
18671883#[ derive( Debug ) ]  
18681884#[ stable( feature = "chunks_exact" ,  since = "1.31.0" ) ]  
1885+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
18691886pub  struct  ChunksExactMut < ' a ,  T :  ' a >  { 
18701887    v :  & ' a  mut  [ T ] , 
18711888    rem :  & ' a  mut  [ T ] , 
@@ -2019,6 +2036,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for ChunksExactMut<'a, T> {
20192036/// [slices]: slice 
20202037#[ derive( Debug ,  Clone ,  Copy ) ]  
20212038#[ unstable( feature = "array_windows" ,  issue = "75027" ) ]  
2039+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
20222040pub  struct  ArrayWindows < ' a ,  T :  ' a ,  const  N :  usize >  { 
20232041    slice_head :  * const  T , 
20242042    num :  usize , 
@@ -2141,6 +2159,7 @@ impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'_, T, N> {
21412159/// [slices]: slice 
21422160#[ derive( Debug ) ]  
21432161#[ unstable( feature = "array_chunks" ,  issue = "74985" ) ]  
2162+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
21442163pub  struct  ArrayChunks < ' a ,  T :  ' a ,  const  N :  usize >  { 
21452164    iter :  Iter < ' a ,  [ T ;  N ] > , 
21462165    rem :  & ' a  [ T ] , 
@@ -2267,6 +2286,7 @@ unsafe impl<'a, T, const N: usize> TrustedRandomAccessNoCoerce for ArrayChunks<'
22672286/// [slices]: slice 
22682287#[ derive( Debug ) ]  
22692288#[ unstable( feature = "array_chunks" ,  issue = "74985" ) ]  
2289+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
22702290pub  struct  ArrayChunksMut < ' a ,  T :  ' a ,  const  N :  usize >  { 
22712291    iter :  IterMut < ' a ,  [ T ;  N ] > , 
22722292    rem :  & ' a  mut  [ T ] , 
@@ -2381,6 +2401,7 @@ unsafe impl<'a, T, const N: usize> TrustedRandomAccessNoCoerce for ArrayChunksMu
23812401/// [slices]: slice 
23822402#[ derive( Debug ) ]  
23832403#[ stable( feature = "rchunks" ,  since = "1.31.0" ) ]  
2404+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
23842405pub  struct  RChunks < ' a ,  T :  ' a >  { 
23852406    v :  & ' a  [ T ] , 
23862407    chunk_size :  usize , 
@@ -2547,6 +2568,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for RChunks<'a, T> {
25472568/// [slices]: slice 
25482569#[ derive( Debug ) ]  
25492570#[ stable( feature = "rchunks" ,  since = "1.31.0" ) ]  
2571+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
25502572pub  struct  RChunksMut < ' a ,  T :  ' a >  { 
25512573    v :  & ' a  mut  [ T ] , 
25522574    chunk_size :  usize , 
@@ -2714,6 +2736,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for RChunksMut<'a, T> {
27142736/// [slices]: slice 
27152737#[ derive( Debug ) ]  
27162738#[ stable( feature = "rchunks" ,  since = "1.31.0" ) ]  
2739+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
27172740pub  struct  RChunksExact < ' a ,  T :  ' a >  { 
27182741    v :  & ' a  [ T ] , 
27192742    rem :  & ' a  [ T ] , 
@@ -2877,6 +2900,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for RChunksExact<'a, T> {
28772900/// [slices]: slice 
28782901#[ derive( Debug ) ]  
28792902#[ stable( feature = "rchunks" ,  since = "1.31.0" ) ]  
2903+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
28802904pub  struct  RChunksExactMut < ' a ,  T :  ' a >  { 
28812905    v :  & ' a  mut  [ T ] , 
28822906    rem :  & ' a  mut  [ T ] , 
@@ -3043,6 +3067,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for IterMut<'a, T> {
30433067/// [`group_by`]: slice::group_by 
30443068/// [slices]: slice 
30453069#[ unstable( feature = "slice_group_by" ,  issue = "80552" ) ]  
3070+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
30463071pub  struct  GroupBy < ' a ,  T :  ' a ,  P >  { 
30473072    slice :  & ' a  [ T ] , 
30483073    predicate :  P , 
@@ -3129,6 +3154,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for GroupBy<'a, T, P> {
31293154/// [`group_by_mut`]: slice::group_by_mut 
31303155/// [slices]: slice 
31313156#[ unstable( feature = "slice_group_by" ,  issue = "80552" ) ]  
3157+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]  
31323158pub  struct  GroupByMut < ' a ,  T :  ' a ,  P >  { 
31333159    slice :  & ' a  mut  [ T ] , 
31343160    predicate :  P , 
0 commit comments