about summary refs log tree commit diff
path: root/src/doc/rust.md
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-04-21 17:58:52 -0400
committerAlex Crichton <alex@alexcrichton.com>2014-06-24 17:18:48 -0700
commit9e3d0b002a5c2e81d43351c9b8550a3f4ccfb8f9 (patch)
tree1e9a15e8a55cc3947025ab3ac044c2f7977159d9 /src/doc/rust.md
parentf7f95c8f5a6294f161800dbb65a0423bb5248f34 (diff)
downloadrust-9e3d0b002a5c2e81d43351c9b8550a3f4ccfb8f9.tar.gz
rust-9e3d0b002a5c2e81d43351c9b8550a3f4ccfb8f9.zip
librustc: Remove the fallback to `int` from typechecking.
This breaks a fair amount of code. The typical patterns are:

* `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`;

* `println!("{}", 3)`: change to `println!("{}", 3i)`;

* `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`.

RFC #30. Closes #6023.

[breaking-change]
Diffstat (limited to 'src/doc/rust.md')
-rw-r--r--src/doc/rust.md15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md
index b2c56c3a3ca..a9814dccb3f 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -955,11 +955,12 @@ use std::option::{Some, None};
 # fn foo<T>(_: T){}
 
 fn main() {
-    // Equivalent to 'std::iter::range_step(0, 10, 2);'
-    range_step(0, 10, 2);
+    // Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
+    range_step(0u, 10u, 2u);
 
-    // Equivalent to 'foo(vec![std::option::Some(1.0), std::option::None]);'
-    foo(vec![Some(1.0), None]);
+    // Equivalent to 'foo(vec![std::option::Some(1.0f64),
+    // std::option::None]);'
+    foo(vec![Some(1.0f64), None]);
 }
 ~~~~
 
@@ -1475,7 +1476,7 @@ to pointers to the trait name, used as a type.
 ~~~~
 # trait Shape { }
 # impl Shape for int { }
-# let mycircle = 0;
+# let mycircle = 0i;
 let myshape: Box<Shape> = box mycircle as Box<Shape>;
 ~~~~
 
@@ -3613,7 +3614,7 @@ and no-return value closure has type `proc()`.
 An example of creating and calling a closure:
 
 ```rust
-let captured_var = 10;
+let captured_var = 10i;
 
 let closure_no_args = || println!("captured_var={}", captured_var);
 
@@ -3685,7 +3686,7 @@ fn print(a: Box<Printable>) {
 }
 
 fn main() {
-   print(box 10 as Box<Printable>);
+   print(box 10i as Box<Printable>);
 }
 ~~~~