@@ -581,6 +581,8 @@ mod prim_pointer {}
581
581
/// might be made consistent to the behavior of later editions.
582
582
///
583
583
/// ```rust,edition2018
584
+ /// // Rust 2015 and 2018:
585
+ ///
584
586
/// # #![allow(array_into_iter)] // override our `deny(warnings)`
585
587
/// let array: [i32; 3] = [0; 3];
586
588
///
@@ -604,11 +606,13 @@ mod prim_pointer {}
604
606
/// }
605
607
/// ```
606
608
///
607
- /// Starting in the 2021 edition, `array.into_iter()` will use `IntoIterator` normally to iterate
609
+ /// Starting in the 2021 edition, `array.into_iter()` uses `IntoIterator` normally to iterate
608
610
/// by value, and `iter()` should be used to iterate by reference like previous editions.
609
611
///
610
- /// ```rust,edition2021,ignore
611
- /// # // FIXME: ignored because 2021 testing is still unstable
612
+ #[ cfg_attr( bootstrap, doc = "```rust,edition2021,ignore" ) ]
613
+ #[ cfg_attr( not( bootstrap) , doc = "```rust,edition2021" ) ]
614
+ /// // Rust 2021:
615
+ ///
612
616
/// let array: [i32; 3] = [0; 3];
613
617
///
614
618
/// // This iterates by reference:
@@ -631,12 +635,12 @@ mod prim_pointer {}
631
635
/// avoid the `into_iter` syntax on those editions. If an edition update is not
632
636
/// viable/desired, there are multiple alternatives:
633
637
/// * use `iter`, equivalent to the old behavior, creating references
634
- /// * use [`array::IntoIter `], equivalent to the post-2021 behavior (Rust 1.51 +)
638
+ /// * use [`IntoIterator::into_iter `], equivalent to the post-2021 behavior (Rust 1.53 +)
635
639
/// * replace `for ... in array.into_iter() {` with `for ... in array {`,
636
640
/// equivalent to the post-2021 behavior (Rust 1.53+)
637
641
///
638
642
/// ```rust,edition2018
639
- /// use std::array::IntoIter;
643
+ /// // Rust 2015 and 2018:
640
644
///
641
645
/// let array: [i32; 3] = [0; 3];
642
646
///
@@ -647,7 +651,7 @@ mod prim_pointer {}
647
651
/// }
648
652
///
649
653
/// // This iterates by value:
650
- /// for item in IntoIter::new (array) {
654
+ /// for item in IntoIterator::into_iter (array) {
651
655
/// let x: i32 = item;
652
656
/// println!("{}", x);
653
657
/// }
@@ -660,7 +664,7 @@ mod prim_pointer {}
660
664
///
661
665
/// // IntoIter can also start a chain.
662
666
/// // This iterates by value:
663
- /// for item in IntoIter::new (array).enumerate() {
667
+ /// for item in IntoIterator::into_iter (array).enumerate() {
664
668
/// let (i, x): (usize, i32) = item;
665
669
/// println!("array[{}] = {}", i, x);
666
670
/// }
0 commit comments