@@ -3475,8 +3475,10 @@ pub trait Iterator {
34753475 }
34763476 }
34773477
3478- /// [Lexicographically](Ord#lexicographical-comparison) compares the elements of this [`Iterator`] with those
3479- /// of another.
3478+ /// [Lexicographically](Ord#lexicographical-comparison) compares the [`PartialOrd`] elements of
3479+ /// this [`Iterator`] with those of another. The comparison works like short-circuit
3480+ /// evaluation, returning a result without comparing the remaining elements.
3481+ /// As soon as an order can be determined, the evaluation stops and a result is returned.
34803482 ///
34813483 /// # Examples
34823484 ///
@@ -3486,9 +3488,25 @@ pub trait Iterator {
34863488 /// assert_eq!([1.].iter().partial_cmp([1.].iter()), Some(Ordering::Equal));
34873489 /// assert_eq!([1.].iter().partial_cmp([1., 2.].iter()), Some(Ordering::Less));
34883490 /// assert_eq!([1., 2.].iter().partial_cmp([1.].iter()), Some(Ordering::Greater));
3491+ /// ```
34893492 ///
3493+ /// For floating-point numbers, NaN does not have a total order and will result
3494+ /// in `None` when compared:
3495+ ///
3496+ /// ```
34903497 /// assert_eq!([f64::NAN].iter().partial_cmp([1.].iter()), None);
34913498 /// ```
3499+ ///
3500+ /// The results are determined by the order of evaluation.
3501+ ///
3502+ /// ```
3503+ /// use std::cmp::Ordering;
3504+ ///
3505+ /// assert_eq!([1.0, f64::NAN].iter().partial_cmp([2.0, f64::NAN].iter()), Some(Ordering::Less));
3506+ /// assert_eq!([2.0, f64::NAN].iter().partial_cmp([1.0, f64::NAN].iter()), Some(Ordering::Greater));
3507+ /// assert_eq!([f64::NAN, 1.0].iter().partial_cmp([f64::NAN, 2.0].iter()), None);
3508+ /// ```
3509+ ///
34923510 #[ stable( feature = "iter_order" , since = "1.5.0" ) ]
34933511 fn partial_cmp < I > ( self , other : I ) -> Option < Ordering >
34943512 where
0 commit comments