From f761d757e7d99d7ba2d381431a5e5ab8f9440b85 Mon Sep 17 00:00:00 2001 From: evuez Date: Tue, 8 Nov 2016 10:46:58 +0100 Subject: [PATCH] Convert "Chapter XX" to correct numbers See #122. --- src/ch01-02-hello-world.md | 2 +- src/ch02-00-guessing-game-tutorial.md | 4 ++-- src/ch04-01-ownership.md | 6 +++--- src/ch04-02-references-and-borrowing.md | 2 +- src/ch04-03-slices.md | 4 ++-- src/ch05-01-method-syntax.md | 2 +- src/ch08-01-vectors.md | 2 +- src/ch09-02-recoverable-errors-with-result.md | 2 +- src/ch09-03-to-panic-or-not-to-panic.md | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ch01-02-hello-world.md b/src/ch01-02-hello-world.md index b722298c5..aaa5778d6 100644 --- a/src/ch01-02-hello-world.md +++ b/src/ch01-02-hello-world.md @@ -101,7 +101,7 @@ that it’s indented with four spaces, not a tab. The second important part is `println!`. This is calling a Rust *macro*, which is how metaprogramming is done in Rust. If it were calling a function instead, it would look like this: `println` (without the `!`). We'll discuss -Rust macros in more detail in Chapter XX, but for now you just need to know +Rust macros in more detail in Chapter 24, but for now you just need to know that when you see a `!` that means that you’re calling a macro instead of a normal function. diff --git a/src/ch02-00-guessing-game-tutorial.md b/src/ch02-00-guessing-game-tutorial.md index b002b29d9..ff58b4fa7 100644 --- a/src/ch02-00-guessing-game-tutorial.md +++ b/src/ch02-00-guessing-game-tutorial.md @@ -487,7 +487,7 @@ available and reevaluate your `rand` requirements according to the new version you specified. There’s a lot more to say about [Cargo][doccargo] and [its -ecosystem][doccratesio] that Chapter XX will discuss, but for +ecosystem][doccratesio] that Chapter 14 will discuss, but for now, that’s all you need to know. Cargo makes it very easy to reuse libraries, so Rustaceans are able to write smaller projects that are assembled from a number of packages. @@ -659,7 +659,7 @@ expression fits that arm’s pattern. Rust takes the value given to `match` and looks through each arm’s pattern in turn. The `match` construct and patterns are powerful features in Rust that let you express a variety of situations your code might encounter and helps ensure that you handle them all. These features -will be covered in detail in Chapter 6 and Chapter XX, respectively. +will be covered in detail in Chapter 6 and Chapter 19, respectively. Let’s walk through an example of what would happen with the `match` expression used here. Say that the user has guessed 50, and the randomly generated secret diff --git a/src/ch04-01-ownership.md b/src/ch04-01-ownership.md index 1d113e1be..00593cec2 100644 --- a/src/ch04-01-ownership.md +++ b/src/ch04-01-ownership.md @@ -133,7 +133,7 @@ explore how Rust knows when to clean that data up. We’re going to use `String` as the example here and concentrate on the parts of `String` that relate to ownership. These aspects also apply to other complex data types provided by the standard library and that you create. We’ll go into -more depth about `String` specifically in Chapter XX. +more depth about `String` specifically in Chapter 8. We’ve already seen string literals, where a string value is hard-coded into our program. String literals are convenient, but they aren’t always suitable for @@ -353,7 +353,7 @@ copying can be assumed to be inexpensive. If we *do* want to deeply copy the `String`’s data and not just the `String` itself, there’s a common method for that: `clone`. We will discuss methods in -the section on [`structs` in Chapter XX][structs], but they’re a +the section on [`structs` in Chapter 5][structs], but they’re a common enough feature in many programming languages that you have probably seen them before. @@ -398,7 +398,7 @@ deep and shallow copying here, so calling `clone` wouldn’t do anything differently from the usual shallow copying and we can leave it out. Rust has a special annotation called the `Copy` trait that we can place on -types like these (we’ll talk more about traits in Chapter XX). If a type has +types like these (we’ll talk more about traits in Chapter 23). If a type has the `Copy` trait, an older variable is still usable after assignment. Rust will not let us annotate a type with the `Copy` trait if the type, or any of its parts, has implemented `drop`. If the type needs something special to happen diff --git a/src/ch04-02-references-and-borrowing.md b/src/ch04-02-references-and-borrowing.md index 598b7b7d2..748590d38 100644 --- a/src/ch04-02-references-and-borrowing.md +++ b/src/ch04-02-references-and-borrowing.md @@ -257,7 +257,7 @@ error: aborting due to previous error ``` This error message refers to a feature we haven’t learned about yet: -*lifetimes*. We’ll discuss lifetimes in detail in Chapter XX, but, disregarding +*lifetimes*. We’ll discuss lifetimes in detail in Chapter 20, but, disregarding the parts about lifetimes, the message does contain the key to why this code is a problem: `this function’s return type contains a borrowed value, but there is no value for it to be borrowed from`. diff --git a/src/ch04-03-slices.md b/src/ch04-03-slices.md index 0a10a0846..c07d1ac50 100644 --- a/src/ch04-03-slices.md +++ b/src/ch04-03-slices.md @@ -50,7 +50,7 @@ array of bytes using the `as_bytes` method. for (i, &item) in bytes.iter().enumerate() { ``` -We will be discussing iterators in more detail in Chapter XX, but for now, know +We will be discussing iterators in more detail in Chapter 16, but for now, know that `iter` is a method that returns each element in a collection, and `enumerate` modifies the result of `iter` and returns each element as part of a tuple instead, where the first element of the tuple is the index, and the @@ -355,7 +355,7 @@ let slice = &a[1..3]; This slice has the type `&[i32]`. It works the exact same way as string slices do, by storing a reference to the first element and a length. You’ll use this kind of slice for all sorts of other collections. We’ll discuss these in detail -when we talk about vectors in Chapter XX. +when we talk about vectors in Chapter 8. ## Summary diff --git a/src/ch05-01-method-syntax.md b/src/ch05-01-method-syntax.md index 41b36229a..38cc9c3eb 100644 --- a/src/ch05-01-method-syntax.md +++ b/src/ch05-01-method-syntax.md @@ -5,7 +5,7 @@ their name, they can take arguments and return values, and they contain some code that gets run when they're called from somewhere else. Methods are different from functions, however, because they're defined within the context of a struct (or an enum or a trait object, which we will cover in Chapters 6 -and XX respectively), and their first argument is always `self`, which +and 23 respectively), and their first argument is always `self`, which represents the instance of the struct that the method is being called on. ### Defining Methods diff --git a/src/ch08-01-vectors.md b/src/ch08-01-vectors.md index de42972ce..dbdfebe41 100644 --- a/src/ch08-01-vectors.md +++ b/src/ch08-01-vectors.md @@ -206,7 +206,7 @@ always handle every possible case. Using an enum for storing different types in a vector does imply that we need to know the set of types we'll want to store at compile time. If that's not the case, instead of an enum, we can use a trait object. We'll learn about those in -Chapter XX. +Chapter 23. Now that we've gone over some of the most common ways to use vectors, be sure to take a look at the API documentation for other useful methods defined on diff --git a/src/ch09-02-recoverable-errors-with-result.md b/src/ch09-02-recoverable-errors-with-result.md index a898a9293..5cc5f0d91 100644 --- a/src/ch09-02-recoverable-errors-with-result.md +++ b/src/ch09-02-recoverable-errors-with-result.md @@ -20,7 +20,7 @@ The `Ok` variant indicates a successful result, and `Err` indicates an unsuccessful result. These two variants each contain one thing: in `Ok`'s case, it's the successful return value. With `Err`, it's some value that represents the error. The `T` and `E` are generic type parameters; we'll go into generics -in more detail in Chapter XX. What you need to know for right now is that the +in more detail in Chapter 10. What you need to know for right now is that the `Result` type is defined such that it can have the same behavior for any type `T` that is what we want to return in the success case, and any type `E` that is what we want to return in the error case. diff --git a/src/ch09-03-to-panic-or-not-to-panic.md b/src/ch09-03-to-panic-or-not-to-panic.md index 94e38cea7..d9f94f1d2 100644 --- a/src/ch09-03-to-panic-or-not-to-panic.md +++ b/src/ch09-03-to-panic-or-not-to-panic.md @@ -141,7 +141,7 @@ that would be a violation of the contract that `Guess::new` is relying on. This function needs to signal to the calling code that it has a bug somewhere leading to the contract violation. The conditions in which `Guess::new` might panic should be discussed in its public-facing API documentation, which we will -cover in Chapter XX. +cover in Chapter 14. Important to note is the `value` field of the `Guess` struct is private, so code using this struct may not set that value directly. Callers *must* use the