diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index c066d535f24e5..853059f98a609 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2015,6 +2015,9 @@ pub trait Iterator { /// Find the maximum value: /// /// ``` + /// #![feature(iterator_fold_self)] + /// use std::cmp::Ordering; + /// /// fn find_max(iter: I) -> Option /// where I: Iterator, /// I::Item: Ord, @@ -2027,9 +2030,9 @@ pub trait Iterator { /// }) /// } /// let a = [10, 20, 5, -23, 0]; - /// let b = []; + /// let b: [u32; 0] = []; /// - /// assert_eq!(find_max(a.iter()), Some(20)); + /// assert_eq!(find_max(a.iter()), Some(&20)); /// assert_eq!(find_max(b.iter()), None); /// ``` #[inline]