about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/guide-crates.md16
-rw-r--r--src/doc/guide-error-handling.md6
-rw-r--r--src/doc/guide-ownership.md18
-rw-r--r--src/doc/guide-pointers.md18
-rw-r--r--src/doc/guide-strings.md6
-rw-r--r--src/doc/guide.md155
-rw-r--r--src/doc/intro.md10
-rw-r--r--src/doc/reference.md18
8 files changed, 150 insertions, 97 deletions
diff --git a/src/doc/guide-crates.md b/src/doc/guide-crates.md
index 50d76371cc5..b567c747d6f 100644
--- a/src/doc/guide-crates.md
+++ b/src/doc/guide-crates.md
@@ -32,7 +32,7 @@ two languages for those phrases to be in. We'll use this module layout:
               +---------+   |   +-----------+
               |             +---| farewells |
 +---------+   |                 +-----------+
-| phrases |---+ 
+| phrases |---+
 +---------+   |                  +-----------+
               |              +---| greetings |
               +----------+   |   +-----------+
@@ -219,7 +219,7 @@ Put this in `src/english/greetings.rs`:
 
 fn hello() -> String {
     "Hello!".to_string()
-}  
+}
 ```
 
 Put this in `src/english/farewells.rs`:
@@ -229,7 +229,7 @@ Put this in `src/english/farewells.rs`:
 
 fn goodbye() -> String {
     "Goodbye.".to_string()
-} 
+}
 ```
 
 Put this in `src/japanese/greetings.rs`:
@@ -239,7 +239,7 @@ Put this in `src/japanese/greetings.rs`:
 
 fn hello() -> String {
     "こんにちは".to_string()
-}  
+}
 ```
 
 Of course, you can copy and paste this from this web page, or just type
@@ -253,7 +253,7 @@ Put this in `src/japanese/farewells.rs`:
 
 fn goodbye() -> String {
     "さようなら".to_string()
-} 
+}
 ```
 
 (This is "Sayoonara", if you're curious.)
@@ -381,11 +381,11 @@ $ cargo run
 /home/you/projects/phrases/src/japanese/greetings.rs:1:1: 3:2 warning: code is never used: `hello`, #[warn(dead_code)] on by default
 /home/you/projects/phrases/src/japanese/greetings.rs:1 fn hello() -> String {
 /home/you/projects/phrases/src/japanese/greetings.rs:2     "こんにちは".to_string()
-/home/you/projects/phrases/src/japanese/greetings.rs:3 } 
+/home/you/projects/phrases/src/japanese/greetings.rs:3 }
 /home/you/projects/phrases/src/japanese/farewells.rs:1:1: 3:2 warning: code is never used: `goodbye`, #[warn(dead_code)] on by default
 /home/you/projects/phrases/src/japanese/farewells.rs:1 fn goodbye() -> String {
 /home/you/projects/phrases/src/japanese/farewells.rs:2     "さようなら".to_string()
-/home/you/projects/phrases/src/japanese/farewells.rs:3 } 
+/home/you/projects/phrases/src/japanese/farewells.rs:3 }
      Running `target/phrases`
 Hello in English: Hello!
 Goodbye in English: Goodbye.
@@ -452,7 +452,7 @@ fn main() {
 
 Rust will give us a compile-time error:
 
-```{notrust,ignore}
+```{notrust}
    Compiling phrases v0.0.1 (file:///home/you/projects/phrases)
 /home/you/projects/phrases/src/main.rs:4:5: 4:40 error: a value named `hello` has already been imported in this module
 /home/you/projects/phrases/src/main.rs:4 use phrases::japanese::greetings::hello;
diff --git a/src/doc/guide-error-handling.md b/src/doc/guide-error-handling.md
index e2a706e59f0..71ca8913ab3 100644
--- a/src/doc/guide-error-handling.md
+++ b/src/doc/guide-error-handling.md
@@ -2,7 +2,7 @@
 
 > The best-laid plans of mice and men
 > Often go awry
-> 
+>
 > "Tae a Moose", Robert Burns
 
 Sometimes, things just go wrong. It's important to have a plan for when the
@@ -76,7 +76,7 @@ fn main() {
 
 This will give us an error:
 
-```{notrust,ignore}
+```{notrust}
 error: non-exhaustive patterns: `_` not covered [E0004]
 ```
 
@@ -189,7 +189,7 @@ panic!("boom");
 
 gives
 
-```{notrust,ignore}
+```{notrust}
 task '<main>' panicked at 'boom', hello.rs:2
 ```
 
diff --git a/src/doc/guide-ownership.md b/src/doc/guide-ownership.md
index c1180f7e6a9..aebafebf98e 100644
--- a/src/doc/guide-ownership.md
+++ b/src/doc/guide-ownership.md
@@ -93,7 +93,7 @@ must have a deallocation for each allocation. Rust handles this for you. It
 knows that our handle, `x`, is the owning reference to our box. Rust knows that
 `x` will go out of scope at the end of the block, and so it inserts a call to
 deallocate the memory at the end of the scope. Because the compiler does this
-for us, it's impossible to forget. We always exaclty one deallocations paired
+for us, it's impossible to forget. We always have exactly one deallocation paired
 with each of our allocations.
 
 This is pretty straightforward, but what happens when we want to pass our box
@@ -130,7 +130,7 @@ fn add_one(mut num: Box<int>) {
 
 This does not compile, and gives us an error:
 
-```{notrust,ignore}
+```{notrust}
 error: use of moved value: `x`
    println!("{}", x);
                   ^
@@ -186,11 +186,11 @@ This function takes ownership, because it takes a `Box`, which owns its
 contents. But then we give ownership right back.
 
 In the physical world, you can give one of your possessions to someone for a
-short period of time. You still own your posession, you're just letting someone
+short period of time. You still own your possession, you're just letting someone
 else use it for a while. We call that 'lending' something to someone, and that
 person is said to be 'borrowing' that something from you.
 
-Rust's ownershp system also allows an owner to lend out a handle for a limited
+Rust's ownership system also allows an owner to lend out a handle for a limited
 period. This is also called 'borrowing.' Here's a version of `add_one` which
 borrows its argument rather than taking ownership:
 
@@ -231,7 +231,7 @@ fn add_one(num: &int) -> int {
 
 Rust has a feature called 'lifetime elision,' which allows you to not write
 lifetime annotations in certain circumstances. This is one of them. Without
-eliding the liftimes, `add_one` looks like this:
+eliding the lifetimes, `add_one` looks like this:
 
 ```rust
 fn add_one<'a>(num: &'a int) -> int {
@@ -254,7 +254,7 @@ This part _declares_ our lifetimes. This says that `add_one` has one lifetime,
 fn add_two<'a, 'b>(...)
 ```
 
-Then in our parameter list, we use the liftimes we've named:
+Then in our parameter list, we use the lifetimes we've named:
 
 ```{rust,ignore}
 ...(num: &'a int) -> ...
@@ -279,7 +279,7 @@ fn main() {
 }
 ```
 
-As you can see, `struct`s can also have liftimes. In a similar way to functions,
+As you can see, `struct`s can also have lifetimes. In a similar way to functions,
 
 ```{rust}
 struct Foo<'a> {
@@ -295,7 +295,7 @@ x: &'a int,
 # }
 ```
 
-uses it. So why do we need a liftime here? We need to ensure that any reference
+uses it. So why do we need a lifetime here? We need to ensure that any reference
 to a `Foo` cannot outlive the reference to an `int` it contains.
 
 ## Thinking in scopes
@@ -406,7 +406,7 @@ fn main() {
 We try to make four `Wheel`s, each with a `Car` that it's attached to. But the
 compiler knows that on the second iteration of the loop, there's a problem:
 
-```{notrust,ignore}
+```{notrust}
 error: use of moved value: `car`
     Wheel { size: 360, owner: car };
                               ^~~
diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md
index f6216760d64..206df711c1a 100644
--- a/src/doc/guide-pointers.md
+++ b/src/doc/guide-pointers.md
@@ -84,7 +84,7 @@ println!("{}", x + z);
 
 This gives us an error:
 
-```{notrust,ignore}
+```{notrust}
 hello.rs:6:24: 6:25 error: mismatched types: expected `int` but found `&int` (expected int but found &-ptr)
 hello.rs:6     println!("{}", x + z);
                                   ^
@@ -132,7 +132,7 @@ Pointers are useful in languages that are pass-by-value, rather than
 pass-by-reference. Basically, languages can make two choices (this is made
 up syntax, it's not Rust):
 
-```{notrust,ignore}
+```{ignore}
 func foo(x) {
     x = 5
 }
@@ -152,7 +152,7 @@ and therefore, can change its value. At the comment, `i` will be `5`.
 So what do pointers have to do with this? Well, since pointers point to a
 location in memory...
 
-```{notrust,ignore}
+```{ignore}
 func foo(&int x) {
     *x = 5
 }
@@ -179,7 +179,7 @@ but here are problems with pointers in other languages:
 Uninitialized pointers can cause a problem. For example, what does this program
 do?
 
-```{notrust,ignore}
+```{ignore}
 &int x;
 *x = 5; // whoops!
 ```
@@ -191,7 +191,7 @@ knows. This might be harmless, and it might be catastrophic.
 When you combine pointers and functions, it's easy to accidentally invalidate
 the memory the pointer is pointing to. For example:
 
-```{notrust,ignore}
+```{ignore}
 func make_pointer(): &int {
     x = 5;
 
@@ -213,7 +213,7 @@ As one last example of a big problem with pointers, **aliasing** can be an
 issue. Two pointers are said to alias when they point at the same location
 in memory. Like this:
 
-```{notrust,ignore}
+```{ignore}
 func mutate(&int i, int j) {
     *i = j;
 }
@@ -398,7 +398,7 @@ fn main() {
 
 It gives this error:
 
-```{notrust,ignore}
+```{notrust}
 test.rs:5:8: 5:10 error: cannot assign to `*x` because it is borrowed
 test.rs:5         *x -= 1;
                   ^~
@@ -522,7 +522,7 @@ boxes, though. As a rough approximation, you can treat this Rust code:
 
 As being similar to this C code:
 
-```{notrust,ignore}
+```{ignore}
 {
     int *x;
     x = (int *)malloc(sizeof(int));
@@ -626,7 +626,7 @@ fn main() {
 
 This prints:
 
-```{notrust,ignore}
+```{ignore}
 Cons(1, box Cons(2, box Cons(3, box Nil)))
 ```
 
diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md
index 071c9ff013c..43cc8483bce 100644
--- a/src/doc/guide-strings.md
+++ b/src/doc/guide-strings.md
@@ -181,7 +181,7 @@ for l in s.graphemes(true) {
 
 This prints:
 
-```{notrust,ignore}
+```{text}

 n͈̰̎
 i̙̮͚̦
@@ -207,7 +207,7 @@ for l in s.chars() {
 
 This prints:
 
-```{notrust,ignore}
+```{text}
 u
 ͔
 n
@@ -252,7 +252,7 @@ for l in s.bytes() {
 
 This will print:
 
-```{notrust,ignore}
+```{text}
 117
 205
 148
diff --git a/src/doc/guide.md b/src/doc/guide.md
index 3f3b533bbd5..21043cfef14 100644
--- a/src/doc/guide.md
+++ b/src/doc/guide.md
@@ -355,7 +355,7 @@ just `cargo build` and it'll work the right way.
 
 You'll also notice that Cargo has created a new file: `Cargo.lock`.
 
-```{ignore,notrust}
+```{ignore}
 [root]
 name = "hello_world"
 version = "0.0.1"
@@ -426,7 +426,7 @@ x = 10i;
 
 It will give you this error:
 
-```{ignore,notrust}
+```{notrust}
 error: re-assignment of immutable variable `x`
      x = 10i;
      ^~~~~~~
@@ -486,7 +486,7 @@ fn main() {
 You can use `cargo build` on the command line to build it. You'll get a warning,
 but it will still print "Hello, world!":
 
-```{ignore,notrust}
+```{notrust}
    Compiling hello_world v0.0.1 (file:///home/you/projects/hello_world)
 src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variable)] on by default
 src/main.rs:2     let x: int;
@@ -664,7 +664,7 @@ let y: int = if x == 5i { 10i; } else { 15i; };
 
 Note the semicolons after the 10 and 15. Rust will give us the following error:
 
-```{ignore,notrust}
+```{notrust}
 error: mismatched types: expected `int` but found `()` (expected int but found ())
 ```
 
@@ -747,7 +747,7 @@ fn print_number(x, y) {
 
 You get this error:
 
-```{ignore,notrust}
+```{notrust}
 hello.rs:5:18: 5:19 error: expected `:` but found `,`
 hello.rs:5 fn print_number(x, y) {
 ```
@@ -779,7 +779,7 @@ fn add_one(x: int) -> int {
 
 We would get an error:
 
-```{ignore,notrust}
+```{ignore}
 error: not all control paths return a value
 fn add_one(x: int) -> int {
      x + 1;
@@ -1160,6 +1160,55 @@ Where a `StringResult` is either an `StringOK`, with the result of a computation
 `ErrorReason` with a `String` explaining what caused the computation to fail. These kinds of
 `enum`s are actually very useful and are even part of the standard library.
 
+Enum variants are namespaced under the enum names. For example, here is an example of using
+our `StringResult`:
+
+```rust
+# enum StringResult {
+#     StringOK(String),
+#     ErrorReason(String),
+# }
+fn respond(greeting: &str) -> StringResult {
+    if greeting == "Hello" {
+        StringResult::StringOK("Good morning!".to_string())
+    } else {
+        StringResult::ErrorReason("I didn't understand you!".to_string())
+    }
+}
+```
+
+Notice that we need both the enum name and the variant name: `StringResult::StringOK`, but
+we didn't need to with `Ordering`, we just said `Greater` rather than `Ordering::Greater`.
+There's a reason: the Rust prelude imports the variants of `Ordering` as well as the enum
+itself. We can use the `use` keyword to do something similar with `StringResult`:
+
+```rust
+use StringResult::StringOK;
+use StringResult::ErrorReason;
+
+enum StringResult {
+    StringOK(String),
+    ErrorReason(String),
+}
+
+# fn main() {}
+
+fn respond(greeting: &str) -> StringResult {
+    if greeting == "Hello" {
+        StringOK("Good morning!".to_string())
+    } else {
+        ErrorReason("I didn't understand you!".to_string())
+    }
+}
+```
+
+We'll learn more about `use` later, but it's used to bring names into scope. `use` declarations
+must come before anything else, which looks a little strange in this example, since we `use`
+the variants before we define them. Anyway, in the body of `respond`, we can just say `StringOK`
+now, rather than the full `StringResult::StringOK`. Importing variants can be convenient, but can
+also cause name conflicts, so do this with caution. It's considered good style to rarely import
+variants for this reason.
+
 As you can see `enum`s with values are quite a powerful tool for data representation,
 and can be even more useful when they're generic across types. But before we get to
 generics, let's talk about how to use them with pattern matching, a tool that will
@@ -1197,7 +1246,7 @@ So what's the big advantage here? Well, there are a few. First of all, `match`
 enforces 'exhaustiveness checking.' Do you see that last arm, the one with the
 underscore (`_`)? If we remove that arm, Rust will give us an error:
 
-```{ignore,notrust}
+```{notrust}
 error: non-exhaustive patterns: `_` not covered
 ```
 
@@ -1344,7 +1393,7 @@ for x in range(0i, 10i) {
 
 In slightly more abstract terms,
 
-```{ignore,notrust}
+```{ignore}
 for var in expression {
     code
 }
@@ -1849,7 +1898,7 @@ Before we move on, let me show you one more Cargo command: `run`. `cargo run`
 is kind of like `cargo build`, but it also then runs the produced executable.
 Try it out:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -1947,7 +1996,7 @@ for this example, it is not important.
 
 Let's try to compile this using `cargo build`:
 
-```{notrust,no_run}
+```{notrust}
 $ cargo build
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
 src/main.rs:7:26: 7:34 error: the type of this value must be known in this context
@@ -1995,7 +2044,7 @@ fn main() {
 
 Try running our new program a few times:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2048,7 +2097,7 @@ fn main() {
 
 And trying it out:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2103,7 +2152,7 @@ fn cmp(a: int, b: int) -> Ordering {
 
 If we try to compile, we'll get some errors:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo build
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
 src/main.rs:20:15: 20:20 error: mismatched types: expected `int` but found `collections::string::String` (expected int but found struct collections::string::String)
@@ -2157,7 +2206,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 
 And try compiling again:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo build
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
 src/main.rs:20:15: 20:20 error: mismatched types: expected `uint` but found `collections::string::String` (expected uint but found struct collections::string::String)
@@ -2170,7 +2219,7 @@ This error is similar to the last one: we expected to get a `uint`, but we got
 a `String` instead! That's because our `input` variable is coming from the
 standard input, and you can guess anything. Try it:
 
-```{notrust,ignore}
+```{notrust}
 $ ./target/guessing_game
 Guess the number!
 The secret number is: 73
@@ -2254,7 +2303,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 
 Let's try it out!
 
-```{notrust,ignore}
+```{notrust}
 $ cargo build
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
 src/main.rs:22:15: 22:24 error: mismatched types: expected `uint` but found `core::option::Option<uint>` (expected uint but found enum core::option::Option)
@@ -2313,7 +2362,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 We use a `match` to either give us the `uint` inside of the `Option`, or we
 print an error message and return. Let's give this a shot:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2378,7 +2427,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 
 Let's try it!
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2455,7 +2504,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 And try it out. But wait, didn't we just add an infinite loop? Yup. Remember
 that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2587,7 +2636,7 @@ fn cmp(a: uint, b: uint) -> Ordering {
 
 Now we should be good! Let's try:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
      Running `target/guessing_game`
@@ -2703,7 +2752,7 @@ $ cd modules
 
 Let's double check our work by compiling:
 
-```{bash,notrust}
+```{bash}
 $ cargo run
    Compiling modules v0.0.1 (file:///home/you/projects/modules)
      Running `target/modules`
@@ -2765,7 +2814,7 @@ mod hello {
 
 It gives an error:
 
-```{notrust,ignore}
+```{notrust}
    Compiling modules v0.0.1 (file:///home/you/projects/modules)
 src/main.rs:2:5: 2:23 error: function `print_hello` is private
 src/main.rs:2     hello::print_hello();
@@ -2789,7 +2838,7 @@ mod hello {
 Usage of the `pub` keyword is sometimes called 'exporting', because
 we're making the function available for other modules. This will work:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling modules v0.0.1 (file:///home/you/projects/modules)
      Running `target/modules`
@@ -2923,7 +2972,7 @@ $ cd testing
 
 And try it out:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running `target/testing`
@@ -2955,7 +3004,7 @@ you give them descriptive names. You'll see why in a moment. We then use a
 macro, `assert!`, to assert that something is true. In this case, we're giving
 it `false`, so this test should fail. Let's try it!
 
-```{notrust,ignore}
+```{notrust}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
 /home/you/projects/testing/src/main.rs:1:1: 3:2 warning: function is never used: `main`, #[warn(dead_code)] on by default
@@ -2984,7 +3033,7 @@ task '<main>' failed at 'Some tests failed', /home/you/src/rust/src/libtest/lib.
 
 Lots of output! Let's break this down:
 
-```{notrust,ignore}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
 ```
@@ -2992,7 +3041,7 @@ $ cargo test
 You can run all of your tests with `cargo test`. This runs both your tests in
 `tests`, as well as the tests you put inside of your crate.
 
-```{notrust,ignore}
+```{notrust}
 /home/you/projects/testing/src/main.rs:1:1: 3:2 warning: function is never used: `main`, #[warn(dead_code)] on by default
 /home/you/projects/testing/src/main.rs:1 fn main() {
 /home/you/projects/testing/src/main.rs:2     println!("Hello, world!")
@@ -3006,7 +3055,7 @@ case, Rust is warning us that we've written some code that's never used: our
 We'll turn this lint off for just this function soon. For now, just ignore this
 output.
 
-```{notrust,ignore}
+```{ignore}
      Running target/lib-654ce120f310a3a5
 
 running 1 test
@@ -3018,7 +3067,7 @@ with good names? This is why. Here, it says 'test foo' because we called our
 test 'foo.' If we had given it a good name, it'd be more clear which test
 failed, especially as we accumulate more tests.
 
-```{notrust,ignore}
+```{notrust}
 failures:
 
 ---- foo stdout ----
@@ -3049,7 +3098,7 @@ fn foo() {
 
 And then try to run our tests again:
 
-```{notrust,ignore}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running target/lib-654ce120f310a3a5
@@ -3089,7 +3138,7 @@ include `main` when it's _not_ true. So we use `not` to negate things:
 With this attribute we won't get the warning (even
 though `src/main.rs` gets recompiled this time):
 
-```{notrust,ignore}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running target/lib-654ce120f310a3a5
@@ -3120,7 +3169,7 @@ fn math_checks_out() {
 
 And try to run the test:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
 /home/you/projects/testing/tests/lib.rs:3:18: 3:38 error: unresolved name `add_three_times_four`.
@@ -3180,7 +3229,7 @@ fn math_checks_out() {
 
 Let's give it a run:
 
-```{ignore,notrust}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running target/lib-654ce120f310a3a5
@@ -3229,7 +3278,7 @@ fn times_four(x: int) -> int { x * 4 }
 
 If you run `cargo test`, you should get the same output:
 
-```{ignore,notrust}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running target/lib-654ce120f310a3a5
@@ -3283,7 +3332,7 @@ fn test_add_three() {
 
 We'd get this error:
 
-```{notrust,ignore}
+```{notrust}
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
 /home/you/projects/testing/tests/lib.rs:3:5: 3:24 error: function `add_three` is private
 /home/you/projects/testing/tests/lib.rs:3 use testing::add_three;
@@ -3325,7 +3374,7 @@ mod test {
 
 Let's give it a shot:
 
-```{ignore,notrust}
+```{ignore}
 $ cargo test
    Compiling testing v0.0.1 (file:///home/you/projects/testing)
      Running target/lib-654ce120f310a3a5
@@ -3455,7 +3504,7 @@ let y = &mut x;
 
 Rust will complain:
 
-```{ignore,notrust}
+```{notrust}
 error: cannot borrow immutable local variable `x` as mutable
  let y = &mut x;
               ^
@@ -3482,7 +3531,7 @@ let z = &mut x;
 
 It gives us this error:
 
-```{notrust,ignore}
+```{notrust}
 error: cannot borrow `x` as mutable more than once at a time
      let z = &mut x;
                   ^
@@ -3628,7 +3677,7 @@ let z = &mut x;
 
 The error:
 
-```{notrust,ignore}
+```{notrust}
 error: cannot borrow `x` as mutable more than once at a time
      let z = &mut x;
                   ^
@@ -3646,7 +3695,7 @@ note: previous borrow ends here
 
 This error comes in three parts. Let's go over each in turn.
 
-```{notrust,ignore}
+```{notrust}
 error: cannot borrow `x` as mutable more than once at a time
      let z = &mut x;
                   ^
@@ -3655,7 +3704,7 @@ error: cannot borrow `x` as mutable more than once at a time
 This error states the restriction: you cannot lend out something mutable more
 than once at the same time. The borrow checker knows the rules!
 
-```{notrust,ignore}
+```{notrust}
 note: previous borrow of `x` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `x` until the borrow ends
      let y = &mut x;
                   ^
@@ -3667,7 +3716,7 @@ the first mutable borrow occurred. The error showed us the second. So now we
 see both parts of the problem. It also alludes to rule #3, by reminding us that
 we can't change `x` until the borrow is over.
 
-```{notrust,ignore}
+```{ignore}
 note: previous borrow ends here
  fn main() {
      let mut x = 5i;
@@ -3681,8 +3730,8 @@ Here's the second note, which lets us know where the first borrow would be over.
 This is useful, because if we wait to try to borrow `x` after this borrow is
 over, then everything will work.
 
-For more advanced patterns, please consult the [Lifetime
-Guide](guide-lifetimes.html).  You'll also learn what this type signature with
+For more advanced patterns, please consult the [Ownership
+Guide](guide-ownership.html).  You'll also learn what this type signature with
 the `'a` syntax is:
 
 ```{rust,ignore}
@@ -3770,7 +3819,7 @@ let y = &mut x;
 
 This gives us this error:
 
-```{notrust,ignore}
+```{notrust}
 error: cannot use `*x` because it was mutably borrowed
  *x;
  ^~
@@ -4595,7 +4644,7 @@ element reference has the closure it's been given as an argument called on it.
 So this would give us the numbers from `2-100`. Well, almost! If you
 compile the example, you'll get a warning:
 
-```{notrust,ignore}
+```{ignore}
 warning: unused result which must be used: iterator adaptors are lazy and
          do nothing unless consumed, #[warn(unused_must_use)] on by default
  range(1i, 100i).map(|x| x + 1i);
@@ -4625,7 +4674,7 @@ for i in std::iter::count(1i, 5i).take(5) {
 
 This will print
 
-```{notrust,ignore}
+```{ignore}
 1
 6
 11
@@ -4838,7 +4887,7 @@ We can then use `T` inside the rest of the signature: `x` has type `T`, and half
 of the `Result` has type `T`. However, if we try to compile that example, we'll get
 an error:
 
-```{notrust,ignore}
+```{notrust}
 error: binary operation `==` cannot be applied to type `T`
 ```
 
@@ -4894,7 +4943,7 @@ we use `impl Trait for Item`, rather than just `impl Item`.
 So what's the big deal? Remember the error we were getting with our generic
 `inverse` function?
 
-```{notrust,ignore}
+```{notrust}
 error: binary operation `==` cannot be applied to type `T`
 ```
 
@@ -4909,7 +4958,7 @@ fn print_area<T>(shape: T) {
 
 Rust complains:
 
-```{notrust,ignore}
+```{notrust}
 error: type `T` does not implement any method in scope named `area`
 ```
 
@@ -4985,7 +5034,7 @@ fn main() {
 
 This program outputs:
 
-```{notrust,ignore}
+```{ignore}
 This shape has an area of 3.141593
 This shape has an area of 1
 ```
@@ -4999,7 +5048,7 @@ print_area(5i);
 
 We get a compile-time error:
 
-```{notrust,ignore}
+```{ignore}
 error: failed to find an implementation of trait main::HasArea for int
 ```
 
@@ -5066,7 +5115,7 @@ fn main() {
 Now that we've moved the structs and traits into their own module, we get an
 error:
 
-```{notrust,ignore}
+```{notrust}
 error: type `shapes::Circle` does not implement any method in scope named `area`
 ```
 
diff --git a/src/doc/intro.md b/src/doc/intro.md
index 01697a3e0cb..e2cccef5b4a 100644
--- a/src/doc/intro.md
+++ b/src/doc/intro.md
@@ -58,13 +58,13 @@ authors = ["Your Name <you@example.com>"]
 ```
 
 This is called a **manifest**, and it contains all of the metadata that Cargo
-needs to compile your project. 
+needs to compile your project.
 
 Here's what's in `src/main.rs`:
 
 ```{rust}
 fn main() {
-    println!("Hello, world!")
+    println!("Hello, world!");
 }
 ```
 
@@ -207,7 +207,7 @@ and two...
 
 ```{bash}
 $ g++ hello.cpp -Wall -Werror
-$ ./a.out 
+$ ./a.out
 Segmentation fault (core dumped)
 ```
 
@@ -313,7 +313,7 @@ print `"Hello"`, or does Rust crash?
 
 Neither. It refuses to compile:
 
-```{notrust,ignore}
+```{notrust}
 $ cargo run
    Compiling hello_world v0.0.1 (file:///Users/you/src/hello_world)
 main.rs:8:5: 8:6 error: cannot borrow `v` as mutable because it is also borrowed as immutable
@@ -428,7 +428,7 @@ fn main() {
 
 It gives us this error:
 
-```{notrust,ignore}
+```{notrust}
 6:71 error: capture of moved value: `numbers`
     for j in range(0, 3) { numbers[j] += 1 }
                ^~~~~~~
diff --git a/src/doc/reference.md b/src/doc/reference.md
index f6ee5cadbc6..660a97cd55f 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -496,9 +496,8 @@ Examples of integer literals of various forms:
 
 A _floating-point literal_ has one of two forms:
 
-* Two _decimal literals_ separated by a period
-  character `U+002E` (`.`), with an optional _exponent_ trailing after the
-  second decimal literal.
+* A _decimal literal_ followed by a period character `U+002E` (`.`). This is
+  optionally followed by another decimal literal, with an optional _exponent_.
 * A single _decimal literal_ followed by an _exponent_.
 
 By default, a floating-point literal has a generic type, and, like integer
@@ -509,12 +508,17 @@ types), which explicitly determine the type of the literal.
 Examples of floating-point literals of various forms:
 
 ```
-123.0f64;                          // type f64
-0.1f64;                            // type f64
-0.1f32;                            // type f32
-12E+99_f64;                        // type f64
+123.0f64;        // type f64
+0.1f64;          // type f64
+0.1f32;          // type f32
+12E+99_f64;      // type f64
+let x: f64 = 2.; // type f64
 ```
 
+This last example is different because it is not possible to use the suffix
+syntax with a floating point literal ending in a period. `2.f64` would attempt
+to call a method named `f64` on `2`.
+
 ##### Boolean literals
 
 The two values of the boolean type are written `true` and `false`.