about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorolivren <o.renaud@gmx.fr>2014-11-27 15:25:29 +0100
committerolivren <o.renaud@gmx.fr>2014-11-27 15:31:11 +0100
commitf01cbaa0baf034850575f75b3724be207c56c41f (patch)
tree09b4b0e2f56b2cb254bc7769a8973c8665b173f9 /src
parent82fc1aa8756bf47679e09a30c5968da9f84b89e5 (diff)
downloadrust-f01cbaa0baf034850575f75b3724be207c56c41f.tar.gz
rust-f01cbaa0baf034850575f75b3724be207c56c41f.zip
Fix example code for unreachable!
The previous code was giving an incorrect result (not x/3).
Diffstat (limited to 'src')
-rw-r--r--src/libstd/macros.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 12ca80bfaab..76419bee41c 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -217,12 +217,11 @@ macro_rules! debug_assert_eq(
 /// Iterators:
 ///
 /// ```rust
-/// fn divide_by_three(x: i32) -> i32 { // one of the poorest implementations of x/3
-///     for i in std::iter::count(0_i32, 1) {
-///         if i < 0 { panic!("i32 overflow"); }
-///         if x < 3*i { return i; }
+/// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
+///     for i in std::iter::count(0_u32, 1) {
+///         if 3*i < i { panic!("u32 overflow"); }
+///         if x < 3*i { return i-1; }
 ///     }
-///
 ///     unreachable!();
 /// }
 /// ```