/// assert_eq!(None, iter.next_back());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "DoubleEndedIterator")]
pub trait DoubleEndedIterator: Iterator {
/// Removes and returns an element from the end of the iterator.
///
/// Folding is useful whenever you have a collection of something, and want
/// to produce a single value from it.
///
+ /// Note: `rfold()` combines elements in a *right-associative* fashion. For associative
+ /// operators like `+`, the order the elements are combined in is not important, but for non-associative
+ /// operators like `-` the order will affect the final result.
+ /// For a *left-associative* version of `rfold()`, see [`Iterator::fold()`].
+ ///
/// # Examples
///
/// Basic usage:
/// assert_eq!(sum, 6);
/// ```
///
- /// This example builds a string, starting with an initial value
+ /// This example demonstrates the right-associative nature of `rfold()`:
+ /// it builds a string, starting with an initial value
/// and continuing with each element from the back until the front:
///
/// ```
///
/// assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))");
/// ```
+ #[doc(alias = "foldr")]
#[inline]
#[stable(feature = "iter_rfold", since = "1.27.0")]
fn rfold<B, F>(mut self, init: B, mut f: F) -> B