Skip to content

Commit 2258159

Browse files
committed
Auto merge of #29172 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #29027, #29125, #29132, #29165, #29168, #29169 - Failed merges:
2 parents c74454a + 2f2d8df commit 2258159

39 files changed

+232
-107
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Building the documentation requires building the compiler, so the above
9898
details will apply. Once you have the compiler built, you can
9999

100100
```sh
101-
$ make docs NO_REBUILD=1
101+
$ make docs NO_REBUILD=1
102102
```
103103

104104
To make sure you don’t re-build the compiler because you made a change

src/doc/nomicon/safe-unsafe-meaning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Some examples of unsafe functions:
4242
* `slice::get_unchecked` will perform unchecked indexing, allowing memory
4343
safety to be freely violated.
4444
* every raw pointer to sized type has intrinsic `offset` method that invokes
45-
Undefined Behaviour if it is not "in bounds" as defined by LLVM.
45+
Undefined Behavior if it is not "in bounds" as defined by LLVM.
4646
* `mem::transmute` reinterprets some value as having the given type,
4747
bypassing type safety in arbitrary ways. (see [conversions] for details)
4848
* All FFI functions are `unsafe` because they can do arbitrary things.

src/doc/trpl/dining-philosophers.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ impl Philosopher {
512512

513513
fn eat(&self, table: &Table) {
514514
let _left = table.forks[self.left].lock().unwrap();
515+
thread::sleep_ms(150);
515516
let _right = table.forks[self.right].lock().unwrap();
516517

517518
println!("{} is eating.", self.name);
@@ -597,6 +598,7 @@ We now need to construct those `left` and `right` values, so we add them to
597598
```rust,ignore
598599
fn eat(&self, table: &Table) {
599600
let _left = table.forks[self.left].lock().unwrap();
601+
thread::sleep_ms(150);
600602
let _right = table.forks[self.right].lock().unwrap();
601603
602604
println!("{} is eating.", self.name);
@@ -607,11 +609,14 @@ fn eat(&self, table: &Table) {
607609
}
608610
```
609611

610-
We have two new lines. We’ve also added an argument, `table`. We access the
612+
We have three new lines. We’ve added an argument, `table`. We access the
611613
`Table`’s list of forks, and then use `self.left` and `self.right` to access
612614
the fork at that particular index. That gives us access to the `Mutex` at that
613615
index, and we call `lock()` on it. If the mutex is currently being accessed by
614-
someone else, we’ll block until it becomes available.
616+
someone else, we’ll block until it becomes available. We have also a call to
617+
`thread::sleep_ms` between the moment first fork is picked and the moment the
618+
second forked is picked, as the process of picking up the fork is not
619+
immediate.
615620

616621
The call to `lock()` might fail, and if it does, we want to crash. In this
617622
case, the error that could happen is that the mutex is [‘poisoned’][poison],
@@ -660,7 +665,9 @@ We need to pass in our `left` and `right` values to the constructors for our
660665
you look at the pattern, it’s all consistent until the very end. Monsieur
661666
Foucault should have `4, 0` as arguments, but instead, has `0, 4`. This is what
662667
prevents deadlock, actually: one of our philosophers is left handed! This is
663-
one way to solve the problem, and in my opinion, it’s the simplest.
668+
one way to solve the problem, and in my opinion, it’s the simplest. If you
669+
change the order of the parameters, you will be able to observe the deadlock
670+
taking place.
664671

665672
```rust,ignore
666673
let handles: Vec<_> = philosophers.into_iter().map(|p| {

src/doc/trpl/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ hello.rs:4 }
7373
```
7474

7575
This [unfortunate error](https://github.com/rust-lang/rust/issues/22547) is
76-
correct: documentation comments apply to the thing after them, and there's
76+
correct: documentation comments apply to the thing after them, and there's
7777
nothing after that last comment.
7878

7979
[rc-new]: https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new

src/doc/trpl/method-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ kinds of things `foo` could be: `self` if it’s just a value on the stack,
5555
`&self` if it’s a reference, and `&mut self` if it’s a mutable reference.
5656
Because we took the `&self` parameter to `area`, we can use it just like any
5757
other parameter. Because we know it’s a `Circle`, we can access the `radius`
58-
just like we would with any other `struct`.
58+
just like we would with any other `struct`.
5959

6060
We should default to using `&self`, as you should prefer borrowing over taking
6161
ownership, as well as taking immutable references over mutable ones. Here’s an

src/doc/trpl/mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8484

8585
> You may have one or the other of these two kinds of borrows, but not both at
8686
> the same time:
87-
>
87+
>
8888
> * one or more references (`&T`) to a resource,
8989
> * exactly one mutable reference (`&mut T`).
9090

src/doc/trpl/ownership.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ With that in mind, let’s learn about ownership.
4242
# Ownership
4343

4444
[Variable bindings][bindings] have a property in Rust: they ‘have ownership’
45-
of what they’re bound to. This means that when a binding goes out of scope,
45+
of what they’re bound to. This means that when a binding goes out of scope,
4646
Rust will free the bound resources. For example:
4747

4848
```rust
@@ -158,8 +158,8 @@ has no pointers to data somewhere else, copying it is a full copy.
158158

159159
All primitive types implement the `Copy` trait and their ownership is
160160
therefore not moved like one would assume, following the ´ownership rules´.
161-
To give an example, the two following snippets of code only compile because the
162-
`i32` and `bool` types implement the `Copy` trait.
161+
To give an example, the two following snippets of code only compile because the
162+
`i32` and `bool` types implement the `Copy` trait.
163163

164164
```rust
165165
fn main() {

src/doc/trpl/references-and-borrowing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ So when we add the curly braces:
233233
```rust
234234
let mut x = 5;
235235

236-
{
236+
{
237237
let y = &mut x; // -+ &mut borrow starts here
238238
*y += 1; // |
239239
} // -+ ... and ends here
@@ -306,7 +306,7 @@ which was invalid. For example:
306306

307307
```rust,ignore
308308
let y: &i32;
309-
{
309+
{
310310
let x = 5;
311311
y = &x;
312312
}
@@ -323,7 +323,7 @@ error: `x` does not live long enough
323323
note: reference must be valid for the block suffix following statement 0 at
324324
2:16...
325325
let y: &i32;
326-
{
326+
{
327327
let x = 5;
328328
y = &x;
329329
}

src/doc/trpl/strings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ println!("");
102102
This prints:
103103

104104
```text
105-
229, 191, 160, 231, 138, 172, 227, 131, 143, 227, 131, 129, 229, 133, 172,
106-
忠, 犬, ハ, チ, 公,
105+
229, 191, 160, 231, 138, 172, 227, 131, 143, 227, 131, 129, 229, 133, 172,
106+
忠, 犬, ハ, チ, 公,
107107
```
108108

109109
As you can see, there are more bytes than `char`s.

src/libbacktrace/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# met:
77

88
# (1) Redistributions of source code must retain the above copyright
9-
# notice, this list of conditions and the following disclaimer.
9+
# notice, this list of conditions and the following disclaimer.
1010

1111
# (2) Redistributions in binary form must reproduce the above copyright
1212
# notice, this list of conditions and the following disclaimer in
1313
# the documentation and/or other materials provided with the
14-
# distribution.
14+
# distribution.
1515

1616
# (3) The name of the author may not be used to
1717
# endorse or promote products derived from this software without

0 commit comments

Comments
 (0)