diff --git a/src/doc/trpl/concurrency.md b/src/doc/trpl/concurrency.md index d6590e956a84..3c64e0b14de4 100644 --- a/src/doc/trpl/concurrency.md +++ b/src/doc/trpl/concurrency.md @@ -6,7 +6,7 @@ and more cores, yet many programmers aren't prepared to fully utilize them. Rust's memory safety features also apply to its concurrency story too. Even concurrent Rust programs must be memory safe, having no data races. Rust's type -system is up to the thread, and gives you powerful ways to reason about +system is up to the task, and gives you powerful ways to reason about concurrent code at compile time. Before we talk about the concurrency features that come with Rust, it's important diff --git a/src/doc/trpl/dining-philosophers.md b/src/doc/trpl/dining-philosophers.md index 81280e8920ca..87877f02fac6 100644 --- a/src/doc/trpl/dining-philosophers.md +++ b/src/doc/trpl/dining-philosophers.md @@ -73,6 +73,9 @@ a name is all we need. We choose the [`String`][string] type for the name, rather than `&str`. Generally speaking, working with a type which owns its data is easier than working with one that uses references. +[struct]: structs.html +[string]: strings.html + Let’s continue: ```rust diff --git a/src/doc/trpl/enums.md b/src/doc/trpl/enums.md index ad15d19eae14..01905caf5ec0 100644 --- a/src/doc/trpl/enums.md +++ b/src/doc/trpl/enums.md @@ -55,9 +55,6 @@ fn process_color_change(msg: Message) { } ``` -Both variants are named `Digit`, but since they’re scoped to the `enum` name -there's no ambiguity. - Not supporting these operations may seem rather limiting, but it’s a limitation which we can overcome. There are two ways: by implementing equality ourselves, or by pattern matching variants with [`match`][match] expressions, which you’ll @@ -66,3 +63,4 @@ equality yet, but we’ll find out in the [`traits`][traits] section. [match]: match.html [if-let]: if-let.html +[traits]: traits.html diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index e5702ed16354..e113ce934497 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -213,12 +213,12 @@ The next part will use this handle to get input from the user: ``` Here, we call the [`read_line()`][read_line] method on our handle. -[Method][method]s are like associated functions, but are only available on a +[Methods][method] are like associated functions, but are only available on a particular instance of a type, rather than the type itself. We’re also passing one argument to `read_line()`: `&mut guess`. [read_line]: ../std/io/struct.Stdin.html#method.read_line -[method]: methods.html +[method]: method-syntax.html Remember how we bound `guess` above? We said it was mutable. However, `read_line` doesn’t take a `String` as an argument: it takes a `&mut String`. diff --git a/src/doc/trpl/match.md b/src/doc/trpl/match.md index 2bb2359ba5a0..113e218883b3 100644 --- a/src/doc/trpl/match.md +++ b/src/doc/trpl/match.md @@ -97,4 +97,4 @@ Unlike the previous uses of `match`, you can’t use the normal `if` statement to do this. You can use the [`if let`][if-let] statement, which can be seen as an abbreviated form of `match`. -[if-let][if-let.html] +[if-let]: if-let.html diff --git a/src/doc/trpl/mutability.md b/src/doc/trpl/mutability.md index 674d65974494..7186c65cdf42 100644 --- a/src/doc/trpl/mutability.md +++ b/src/doc/trpl/mutability.md @@ -35,7 +35,7 @@ let y = &mut x; `y` is an immutable binding to a mutable reference, which means that you can’t bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s -bound to `y`. (`*y = 5`) A subtle distinction. +bound to `y` (`*y = 5`). A subtle distinction. Of course, if you need both: diff --git a/src/doc/trpl/patterns.md b/src/doc/trpl/patterns.md index 266c1cafdee5..93df0f19e8ee 100644 --- a/src/doc/trpl/patterns.md +++ b/src/doc/trpl/patterns.md @@ -66,7 +66,7 @@ match x { } ``` -This prints `something else` +This prints `something else`. # Bindings @@ -152,7 +152,7 @@ match x { } ``` -This prints `Got an int!` +This prints `Got an int!`. # ref and ref mut diff --git a/src/doc/trpl/structs.md b/src/doc/trpl/structs.md index ad7ead931998..5729aeefbac9 100644 --- a/src/doc/trpl/structs.md +++ b/src/doc/trpl/structs.md @@ -196,3 +196,5 @@ useful. For instance, a library may ask you to create a structure that implements a certain [trait][trait] to handle events. If you don’t have any data you need to store in the structure, you can just create a unit-like struct. + +[trait]: traits.html diff --git a/src/doc/trpl/the-stack-and-the-heap.md b/src/doc/trpl/the-stack-and-the-heap.md index 9622a92303f1..c47dbd978935 100644 --- a/src/doc/trpl/the-stack-and-the-heap.md +++ b/src/doc/trpl/the-stack-and-the-heap.md @@ -430,7 +430,7 @@ Next, `foo()` calls `bar()` with `x` and `z`: | 230 | | 20 | | (230) - 1 | | 5 | | ... | ... | ... | -| 10 | e | 4 | +| 10 | e | 9 | | 9 | d | (230) - 1 | | 8 | c | 5 | | 7 | b | 4 | @@ -455,7 +455,7 @@ At the end of `bar()`, it calls `baz()`: | ... | ... | ... | | 12 | g | 100 | | 11 | f | 4 | -| 10 | e | 4 | +| 10 | e | 9 | | 9 | d | (230) - 1 | | 8 | c | 5 | | 7 | b | 4 | @@ -477,7 +477,7 @@ After `baz()` is over, we get rid of `f` and `g`: | 230 | | 20 | | (230) - 1 | | 5 | | ... | ... | ... | -| 10 | e | 4 | +| 10 | e | 9 | | 9 | d | (230) - 1 | | 8 | c | 5 | | 7 | b | 4 | diff --git a/src/doc/trpl/while-loops.md b/src/doc/trpl/while-loops.md index e71d2033f49e..a56c546b5516 100644 --- a/src/doc/trpl/while-loops.md +++ b/src/doc/trpl/while-loops.md @@ -3,7 +3,7 @@ Rust also has a `while` loop. It looks like this: ```{rust} -let mut x = 5; // mut x: u32 +let mut x = 5; // mut x: i32 let mut done = false; // mut done: bool while !done { diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index baef6ba6f01f..198627ad2fc3 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -396,6 +396,7 @@ macro_rules! utf8_acc_cont_byte { #[stable(feature = "rust1", since = "1.0.0")] impl Borrow for String { + #[inline] fn borrow(&self) -> &str { &self[..] } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 220a0ba5755f..2e48cde18f36 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -40,7 +40,7 @@ //! [`result`](result/index.html) modules define optional and //! error-handling types, `Option` and `Result`. The //! [`iter`](iter/index.html) module defines Rust's iterator trait, -//! [`Iterater`](iter/trait.Iterator.html), which works with the `for` +//! [`Iterator`](iter/trait.Iterator.html), which works with the `for` //! loop to access collections. //! //! The common container type, `Vec`, a growable vector backed by an array,