Skip to content

Commit c1368fc

Browse files
committed
Auto merge of #39981 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests - Successful merges: #39913, #39937, #39976 - Failed merges:
2 parents 5b7c556 + 9a8dbbe commit c1368fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+483
-373
lines changed

src/Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/doc/book/src/casting-between-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ most dangerous features of Rust!
88
# Coercion
99

1010
Coercion between types is implicit and has no syntax of its own, but can
11-
be spelled out with [`as`](#Explicit%20coercions).
11+
be spelled out with [`as`](#explicit-coercions).
1212

1313
Coercion occurs in `let`, `const`, and `static` statements; in
1414
function call arguments; in field values in struct initialization; and in a

src/doc/book/src/closures.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ fn factory() -> &(Fn(i32) -> i32) {
463463

464464
Right. Because we have a reference, we need to give it a lifetime. But
465465
our `factory()` function takes no arguments, so
466-
[elision](lifetimes.html#Lifetime%20Elision) doesn’t kick in here. Then what
466+
[elision](lifetimes.html#lifetime-elision) doesn’t kick in here. Then what
467467
choices do we have? Try `'static`:
468468

469469
```rust,ignore

src/doc/book/src/compiler-plugins.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ enum. For a more involved macro example, see
127127

128128
## Tips and tricks
129129

130-
Some of the [macro debugging tips](macros.html#Debugging%20macro%20code) are applicable.
130+
Some of the [macro debugging tips](macros.html#debugging-macro-code) are applicable.
131131

132132
You can use `syntax::parse` to turn token trees into
133133
higher-level syntax elements like expressions:

src/doc/book/src/concurrency.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ For sharing references across threads, Rust provides a wrapper type called
5555
`Arc<T>`. `Arc<T>` implements `Send` and `Sync` if and only if `T` implements
5656
both `Send` and `Sync`. For example, an object of type `Arc<RefCell<U>>` cannot
5757
be transferred across threads because
58-
[`RefCell`](choosing-your-guarantees.html#RefCell%3CT%3E) does not implement
58+
[`RefCell`](choosing-your-guarantees.html#refcellt) does not implement
5959
`Sync`, consequently `Arc<RefCell<U>>` would not implement `Send`.
6060

6161
These two traits allow you to use the type system to make strong guarantees
@@ -126,7 +126,7 @@ closure only captures a _reference to `x`_. This is a problem, because the
126126
thread may outlive the scope of `x`, leading to a dangling pointer.
127127

128128
To fix this, we use a `move` closure as mentioned in the error message. `move`
129-
closures are explained in depth [here](closures.html#move%20closures); basically
129+
closures are explained in depth [here](closures.html#move-closures); basically
130130
they move variables from their environment into themselves.
131131

132132
```rust

src/doc/book/src/error-handling.md

+36-36
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,35 @@ sum types and combinators, and try to motivate the way Rust does error handling
2121
incrementally. As such, programmers with experience in other expressive type
2222
systems may want to jump around.
2323

24-
* [The Basics](#The%20Basics)
25-
* [Unwrapping explained](#Unwrapping%20explained)
26-
* [The `Option` type](#The%20Option%20type)
27-
* [Composing `Option<T>` values](#Composing%20Option%3CT%3E%20values)
28-
* [The `Result` type](#The%20Result%20type)
29-
* [Parsing integers](#Parsing%20integers)
30-
* [The `Result` type alias idiom](#The%20Result%20type%20alias%20idiom)
31-
* [A brief interlude: unwrapping isn't evil](#A%20brief%20interlude:%20unwrapping%20isnt%20evil)
32-
* [Working with multiple error types](#Working%20with%20multiple%20error%20types)
33-
* [Composing `Option` and `Result`](#Composing%20Option%20and%20Result)
34-
* [The limits of combinators](#The%20limits%20of%20combinators)
35-
* [Early returns](#Early%20returns)
36-
* [The `try!` macro](#The%20try%20macro)
37-
* [Defining your own error type](#Defining%20your%20own%20error%20type)
38-
* [Standard library traits used for error handling](#Standard%20library%20traits%20used%20for%20error%20handling)
39-
* [The `Error` trait](#The%20Error%20trait)
40-
* [The `From` trait](#The%20From%20trait)
41-
* [The real `try!` macro](#The%20real%20try%20macro)
42-
* [Composing custom error types](#Composing%20custom%20error%20types)
43-
* [Advice for library writers](#Advice%20for%20library%20writers)
44-
* [Case study: A program to read population data](#Case%20study:%20A%20program%20to%20read%20population%20data)
45-
* [Initial setup](#Initial%20setup)
46-
* [Argument parsing](#Argument%20parsing)
47-
* [Writing the logic](#Writing%20the%20logic)
48-
* [Error handling with `Box<Error>`](#Error%20handling%20with%20Box%3CError%3E)
49-
* [Reading from stdin](#Reading%20from%20stdin)
50-
* [Error handling with a custom type](#Error%20handling%20with%20a%20custom%20type)
51-
* [Adding functionality](#Adding%20functionality)
52-
* [The short story](#The%20short%20story)
24+
* [The Basics](#the-basics)
25+
* [Unwrapping explained](#unwrapping-explained)
26+
* [The `Option` type](#the-option-type)
27+
* [Composing `Option<T>` values](#composing-optiont-values)
28+
* [The `Result` type](#the-result-type)
29+
* [Parsing integers](#parsing-integers)
30+
* [The `Result` type alias idiom](#the-result-type-alias-idiom)
31+
* [A brief interlude: unwrapping isn't evil](#a-brief-interlude-unwrapping-isnt-evil)
32+
* [Working with multiple error types](#working-with-multiple-error-types)
33+
* [Composing `Option` and `Result`](#composing-option-and-result)
34+
* [The limits of combinators](#the-limits-of-combinators)
35+
* [Early returns](#early-returns)
36+
* [The `try!` macro](#the-try-macro)
37+
* [Defining your own error type](#defining-your-own-error-type)
38+
* [Standard library traits used for error handling](#standard-library-traits-used-for-error-handling)
39+
* [The `Error` trait](#the-error-trait)
40+
* [The `From` trait](#the-from-trait)
41+
* [The real `try!` macro](#the-real-try-macro)
42+
* [Composing custom error types](#composing-custom-error-types)
43+
* [Advice for library writers](#advice-for-library-writers)
44+
* [Case study: A program to read population data](#case-study-a-program-to-read-population-data)
45+
* [Initial setup](#initial-setup)
46+
* [Argument parsing](#argument-parsing)
47+
* [Writing the logic](#writing-the-logic)
48+
* [Error handling with `Box<Error>`](#error-handling-with-boxerror)
49+
* [Reading from stdin](#reading-from-stdin)
50+
* [Error handling with a custom type](#error-handling-with-a-custom-type)
51+
* [Adding functionality](#adding-functionality)
52+
* [The short story](#the-short-story)
5353

5454
# The Basics
5555

@@ -796,7 +796,7 @@ because of the return types of
796796
[`std::fs::File::open`](../std/fs/struct.File.html#method.open) and
797797
[`std::io::Read::read_to_string`](../std/io/trait.Read.html#method.read_to_string).
798798
(Note that they both use the [`Result` type alias
799-
idiom](#The%20Result%20type%20alias%20idiom) described previously. If you
799+
idiom](#the-result-type-alias-idiom) described previously. If you
800800
click on the `Result` type, you'll [see the type
801801
alias](../std/io/type.Result.html), and consequently, the underlying
802802
`io::Error` type.) The third problem is described by the
@@ -1120,7 +1120,7 @@ returns an `&Error`, which is itself a trait object. We'll revisit the
11201120

11211121
For now, it suffices to show an example implementing the `Error` trait. Let's
11221122
use the error type we defined in the
1123-
[previous section](#Defining%20your%20own%20error%20type):
1123+
[previous section](#defining-your-own-error-type):
11241124

11251125
```rust
11261126
use std::io;
@@ -1493,19 +1493,19 @@ representation. But certainly, this will vary depending on use cases.
14931493
At a minimum, you should probably implement the
14941494
[`Error`](../std/error/trait.Error.html)
14951495
trait. This will give users of your library some minimum flexibility for
1496-
[composing errors](#The%20real%20try%20macro). Implementing the `Error` trait also
1496+
[composing errors](#the-real-try-macro). Implementing the `Error` trait also
14971497
means that users are guaranteed the ability to obtain a string representation
14981498
of an error (because it requires impls for both `fmt::Debug` and
14991499
`fmt::Display`).
15001500

15011501
Beyond that, it can also be useful to provide implementations of `From` on your
15021502
error types. This allows you (the library author) and your users to
1503-
[compose more detailed errors](#Composing%20custom%20error%20types). For example,
1503+
[compose more detailed errors](#composing-custom-error-types). For example,
15041504
[`csv::Error`](http://burntsushi.net/rustdoc/csv/enum.Error.html)
15051505
provides `From` impls for both `io::Error` and `byteorder::Error`.
15061506

15071507
Finally, depending on your tastes, you may also want to define a
1508-
[`Result` type alias](#The%20Result%20type%20alias%20idiom), particularly if your
1508+
[`Result` type alias](#the-result-type-alias-idiom), particularly if your
15091509
library defines a single error type. This is used in the standard library
15101510
for [`io::Result`](../std/io/type.Result.html)
15111511
and [`fmt::Result`](../std/fmt/type.Result.html).
@@ -1538,7 +1538,7 @@ and [`rustc-serialize`](https://crates.io/crates/rustc-serialize) crates.
15381538

15391539
We're not going to spend a lot of time on setting up a project with
15401540
Cargo because it is already covered well in [the Cargo
1541-
section](getting-started.html#Hello%20Cargo) and [Cargo's documentation][14].
1541+
section](getting-started.html#hello-cargo) and [Cargo's documentation][14].
15421542

15431543
To get started from scratch, run `cargo new --bin city-pop` and make sure your
15441544
`Cargo.toml` looks something like this:
@@ -1729,7 +1729,7 @@ error types and you don't need any `From` implementations. The downside is that
17291729
since `Box<Error>` is a trait object, it *erases the type*, which means the
17301730
compiler can no longer reason about its underlying type.
17311731

1732-
[Previously](#The%20limits%20of%20combinators) we started refactoring our code by
1732+
[Previously](#the-limits-of-combinators) we started refactoring our code by
17331733
changing the type of our function from `T` to `Result<T, OurErrorType>`. In
17341734
this case, `OurErrorType` is only `Box<Error>`. But what's `T`? And can we add
17351735
a return type to `main`?

src/doc/book/src/ffi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ pub extern fn hello_rust() -> *const u8 {
680680

681681
The `extern` makes this function adhere to the C calling convention, as
682682
discussed above in "[Foreign Calling
683-
Conventions](ffi.html#Foreign%20calling%20conventions)". The `no_mangle`
683+
Conventions](ffi.html#foreign-calling-conventions)". The `no_mangle`
684684
attribute turns off Rust's name mangling, so that it is easier to link to.
685685

686686
# FFI and panics

src/doc/book/src/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ language]*, which means that most things are expressions, rather than
236236
statements. The `;` indicates that this expression is over, and the next one is
237237
ready to begin. Most lines of Rust code end with a `;`.
238238

239-
[expression-oriented language]: glossary.html#Expression-Oriented%20Language
239+
[expression-oriented language]: glossary.html#expression-oriented-language
240240

241241
## Compiling and Running Are Separate Steps
242242

src/doc/book/src/glossary.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ They can be used to manage control flow in a modular fashion.
5656

5757
A type without a statically known size or alignment. ([more info][link])
5858

59-
[link]: ../nomicon/exotic-sizes.html#Dynamically%20Sized%20Types%20(DSTs)
59+
[link]: ../nomicon/exotic-sizes.html#dynamically-sized-types-dsts
6060

6161
### Expression
6262

@@ -76,8 +76,8 @@ In an expression-oriented language, (nearly) every statement is an expression
7676
and therefore returns a value. Consequently, these expression statements can
7777
themselves form part of larger expressions.
7878

79-
[expression]: glossary.html#Expression
80-
[statement]: glossary.html#Statement
79+
[expression]: glossary.html#expression
80+
[statement]: glossary.html#statement
8181

8282
### Statement
8383

src/doc/book/src/guessing-game.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ there are no arguments, and `{` starts the body of the function. Because
119119
we didn’t include a return type, it’s assumed to be `()`, an empty
120120
[tuple][tuples].
121121

122-
[tuples]: primitive-types.html#Tuples
122+
[tuples]: primitive-types.html#tuples
123123

124124
```rust,ignore
125125
println!("Guess the number!");
@@ -727,7 +727,7 @@ thirty-two bit integer. Rust has [a number of built-in number types][number],
727727
but we’ve chosen `u32`. It’s a good default choice for a small positive number.
728728
729729
[parse]: ../std/primitive.str.html#method.parse
730-
[number]: primitive-types.html#Numeric%20types
730+
[number]: primitive-types.html#numeric-types
731731
732732
Just like `read_line()`, our call to `parse()` could cause an error. What if
733733
our string contained `A👍%`? There’d be no way to convert that to a number. As

src/doc/book/src/lifetimes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ associated with it, but the compiler lets you elide (i.e. omit, see
139139
["Lifetime Elision"][lifetime-elision] below) them in common cases. Before we
140140
get to that, though, let’s look at a short example with explicit lifetimes:
141141

142-
[lifetime-elision]: #Lifetime%20Elision
142+
[lifetime-elision]: #lifetime-elision
143143

144144
```rust,ignore
145145
fn bar<'a>(...)

src/doc/book/src/macros.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Even when Rust code contains un-expanded macros, it can be parsed as a full
430430
tools that process code. It also has a few consequences for the design of
431431
Rust’s macro system.
432432

433-
[ast]: glossary.html#Abstract%20Syntax%20Tree
433+
[ast]: glossary.html#abstract-syntax-tree
434434

435435
One consequence is that Rust must determine, when it parses a macro invocation,
436436
whether the macro stands in for

src/doc/book/src/mutability.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8989
> * exactly one mutable reference (`&mut T`).
9090
9191
[ownership]: ownership.html
92-
[borrowing]: references-and-borrowing.html#Borrowing
92+
[borrowing]: references-and-borrowing.html#borrowing
9393

9494
So, that’s the real definition of ‘immutability’: is this safe to have two
9595
pointers to? In `Arc<T>`’s case, yes: the mutation is entirely contained inside

src/doc/book/src/ownership.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ elements onto them.
6565
Vectors have a [generic type][generics] `Vec<T>`, so in this example `v` will have type
6666
`Vec<i32>`. We'll cover [generics] in detail in a later chapter.
6767

68-
[arrays]: primitive-types.html#Arrays
68+
[arrays]: primitive-types.html#arrays
6969
[vectors]: vectors.html
70-
[heap]: the-stack-and-the-heap.html#The%20Heap
71-
[stack]: the-stack-and-the-heap.html#The%20Stack
70+
[heap]: the-stack-and-the-heap.html#the-heap
71+
[stack]: the-stack-and-the-heap.html#the-stack
7272
[bindings]: variable-bindings.html
7373
[generics]: generics.html
7474

@@ -136,7 +136,7 @@ Rust allocates memory for an integer [i32] on the [stack][sh], copies the bit
136136
pattern representing the value of 10 to the allocated memory and binds the
137137
variable name x to this memory region for future reference.
138138

139-
[i32]: primitive-types.html#Numeric%20types
139+
[i32]: primitive-types.html#numeric-types
140140

141141
Now consider the following code fragment:
142142

src/doc/book/src/primitive-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ soon.
232232
You can assign one tuple into another, if they have the same contained types
233233
and [arity]. Tuples have the same arity when they have the same length.
234234

235-
[arity]: glossary.html#Arity
235+
[arity]: glossary.html#arity
236236

237237
```rust
238238
let mut x = (1, 2); // x: (i32, i32)

0 commit comments

Comments
 (0)