about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-01-26 18:55:39 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-01-26 18:55:39 +0530
commite9617dd0b8a68a5aefb810635ca083b4c4eaed16 (patch)
tree54820844a8e0a1dde9b5c8e9171036508176744f /src
parent43c1a173a874f5513db58b2f5321489a00087484 (diff)
parent70d4f263ba3d1db40f246ebe600992abb1ac85be (diff)
downloadrust-e9617dd0b8a68a5aefb810635ca083b4c4eaed16.tar.gz
rust-e9617dd0b8a68a5aefb810635ca083b4c4eaed16.zip
Rollup merge of #31172 - SimonSapin:patch-17, r=sfackler
The previous example did not do what its description said. In it panicked on integer overflow in debug mode, and went into an infinite loop in release mode (wrapping back to 0 after printing 254).
Diffstat (limited to 'src')
-rw-r--r--src/libcore/iter.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index ddc4fb32cde..3f1c0f6a549 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -4252,13 +4252,15 @@ impl<A: Step> RangeFrom<A> {
     ///
     /// # Examples
     ///
-    /// ```ignore
-    /// for i in (0u8..).step_by(2) {
+    /// ```
+    /// # #![feature(step_by)]
+    ///
+    /// for i in (0u8..).step_by(2).take(10) {
     ///     println!("{}", i);
     /// }
     /// ```
     ///
-    /// This prints all even `u8` values.
+    /// This prints the first ten even natural integers (0 to 18).
     #[unstable(feature = "step_by", reason = "recent addition",
                issue = "27741")]
     pub fn step_by(self, by: A) -> StepBy<A, Self> {