File tree 1 file changed +4
-19
lines changed
1 file changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ mod prim_pointer {}
498
498
/// - [`Copy`]
499
499
/// - [`Clone`]
500
500
/// - [`Debug`]
501
- /// - [`IntoIterator`] (implemented for `&[T; N]` and `&mut [T; N]`)
501
+ /// - [`IntoIterator`] (implemented for `[T; N]`, ` &[T; N]` and `&mut [T; N]`)
502
502
/// - [`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]
503
503
/// - [`Hash`]
504
504
/// - [`AsRef`], [`AsMut`]
@@ -526,31 +526,16 @@ mod prim_pointer {}
526
526
/// assert_eq!([1, 2], &array[1..]);
527
527
///
528
528
/// // This loop prints: 0 1 2
529
- /// for x in & array {
529
+ /// for x in array {
530
530
/// print!("{} ", x);
531
531
/// }
532
532
/// ```
533
533
///
534
- /// An array itself is not iterable:
535
- ///
536
- /// ```compile_fail,E0277
537
- /// let array: [i32; 3] = [0; 3];
538
- ///
539
- /// for x in array { }
540
- /// // error: the trait bound `[i32; 3]: std::iter::Iterator` is not satisfied
541
- /// ```
542
- ///
543
- /// The solution is to coerce the array to a slice by calling a slice method:
534
+ /// You can also iterate over reference to the array's elements:
544
535
///
545
536
/// ```
546
- /// # let array: [i32; 3] = [0; 3];
547
- /// for x in array.iter() { }
548
- /// ```
549
- ///
550
- /// You can also use the array reference's [`IntoIterator`] implementation:
537
+ /// let array: [i32; 3] = [0; 3];
551
538
///
552
- /// ```
553
- /// # let array: [i32; 3] = [0; 3];
554
539
/// for x in &array { }
555
540
/// ```
556
541
///
You can’t perform that action at this time.
0 commit comments