diff --git a/second-edition/src/ch02-00-guessing-game-tutorial.md b/second-edition/src/ch02-00-guessing-game-tutorial.md index dc8ba2c10..c6adb4ade 100644 --- a/second-edition/src/ch02-00-guessing-game-tutorial.md +++ b/second-edition/src/ch02-00-guessing-game-tutorial.md @@ -112,7 +112,7 @@ prelude, you have to bring that type into scope explicitly with a `use` statement. Using the `std::io` library provides you with a number of useful `io`-related features, including the functionality to accept user input. -[prelude]: https://doc.rust-lang.org/std/prelude/ +[prelude]: ../../std/prelude/index.html As you saw in Chapter 1, the `main` function is the entry point into the program: @@ -171,7 +171,7 @@ a new instance of a `String`. [`String`][string] is a string type provided by the standard library that is a growable, UTF-8 encoded bit of text. -[string]: ../std/string/struct.String.html +[string]: ../../std/string/struct.String.html The `::` syntax in the `::new` line indicates that `new` is an *associated function* of the `String` type. An associated function is implemented on a type, @@ -199,14 +199,14 @@ could have written this function call as `std::io::stdin`. The `stdin` function returns an instance of [`std::io::Stdin`][iostdin], which is a type that represents a handle to the standard input for your terminal. -[iostdin]: ../std/io/struct.Stdin.html +[iostdin]: ../../std/io/struct.Stdin.html The next part of the code, `.read_line(&mut guess)`, calls the [`read_line`][read_line] method on the standard input handle to get input from the user. We’re also passing one argument to `read_line`: `&mut guess`. -[read_line]: ../std/io/struct.Stdin.html#method.read_line +[read_line]: ../../std/io/struct.Stdin.html#method.read_line The job of `read_line` is to take whatever the user types into standard input and place that into a string, so it takes that string as an argument. The @@ -249,8 +249,8 @@ passing it, but it also returns a value—in this case, an `Result` in its standard library: a generic [`Result`][result] as well as specific versions for submodules, such as `io::Result`. -[ioresult]: ../std/io/type.Result.html -[result]: ../std/result/enum.Result.html +[ioresult]: ../../std/io/type.Result.html +[result]: ../../std/result/enum.Result.html The `Result` types are [*enumerations*][enums], often referred to as *enums*. An enumeration is a type that can have a fixed set of values, @@ -276,7 +276,7 @@ return value that `Ok` is holding and return just that value to you so you could use it. In this case, that value is the number of bytes in what the user entered into standard input. -[expect]: ../std/result/enum.Result.html#method.expect +[expect]: ../../std/result/enum.Result.html#method.expect If we don’t call `expect`, the program will compile, but we’ll get a warning: @@ -773,7 +773,7 @@ this example program and the comparison with `secret_number` means that Rust will infer that `secret_number` should be a `u32` as well. So now the comparison will be between two values of the same type! -[parse]: ../std/primitive.str.html#method.parse +[parse]: ../../std/primitive.str.html#method.parse The call to `parse` could easily cause an error. If, for example, the string contained `A👍%`, there would be no way to convert that to a number. Because it diff --git a/second-edition/src/ch06-01-defining-an-enum.md b/second-edition/src/ch06-01-defining-an-enum.md index 8168a3956..13f05b0ad 100644 --- a/second-edition/src/ch06-01-defining-an-enum.md +++ b/second-edition/src/ch06-01-defining-an-enum.md @@ -155,7 +155,7 @@ use!][IpAddr] Let’s look at how the standard library defines it embeds the address data inside the variants in the form of two different structs, which are defined differently for each variant: -[IpAddr]: ../std/net/enum.IpAddr.html +[IpAddr]: ../../std/net/enum.IpAddr.html ```rust struct Ipv4Addr { @@ -298,7 +298,7 @@ that can encode the concept of a value being present or absent. This enum is `Option`, and it is [defined by the standard library][option] as follows: -[option]: ../std/option/enum.Option.html +[option]: ../../std/option/enum.Option.html ```rust enum Option { @@ -388,7 +388,7 @@ number of methods that are useful in a variety of situations; you can check them out in [its documentation][docs]. Becoming familiar with the methods on `Option` will be extremely useful in your journey with Rust. -[docs]: ../std/option/enum.Option.html +[docs]: ../../std/option/enum.Option.html In general, in order to use an `Option` value, we want to have code that will handle each variant. We want some code that will run only when we have a diff --git a/second-edition/src/ch08-00-common-collections.md b/second-edition/src/ch08-00-common-collections.md index dcf042440..76abdf97c 100644 --- a/second-edition/src/ch08-00-common-collections.md +++ b/second-edition/src/ch08-00-common-collections.md @@ -19,7 +19,7 @@ collections which are used very often in Rust programs: To learn about the other kinds of collections provided by the standard library, see [the documentation][collections]. -[collections]: ../std/collections +[collections]: ../../std/collections/index.html We’re going to discuss how to create and update vectors, strings, and hash maps, as well as what makes each special. diff --git a/second-edition/src/ch09-02-recoverable-errors-with-result.md b/second-edition/src/ch09-02-recoverable-errors-with-result.md index b51d6ac56..17a47b5b1 100644 --- a/second-edition/src/ch09-02-recoverable-errors-with-result.md +++ b/second-edition/src/ch09-02-recoverable-errors-with-result.md @@ -10,7 +10,7 @@ Recall from Chapter 2 the section on “[Handling Potential Failure with the `Result` Type][handle_failure]” that the `Result` enum is defined as having two variants, `Ok` and `Err`, as follows: -[handle_failure]: ch02-00-guessing-game-tutorial.md#handling-potential-failure-with-the-result-type +[handle_failure]: ch02-00-guessing-game-tutorial.html#handling-potential-failure-with-the-result-type ```rust enum Result {