Skip to content

Commit 2bb61a3

Browse files
committed
More long lines
1 parent 42ef2ad commit 2bb61a3

File tree

5 files changed

+55
-44
lines changed

5 files changed

+55
-44
lines changed

src/incrcomp-debugging.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ want the `TypeckTables` node for some particular fn, so you might write:
6969
RUST_DEP_GRAPH_FILTER='-> TypeckTables & bar'
7070
```
7171

72-
This will select only the predecessors of `TypeckTables` nodes for functions with
73-
`bar` in their name.
72+
This will select only the predecessors of `TypeckTables` nodes for functions
73+
with `bar` in their name.
7474

75-
Perhaps you are finding that when you change `foo` you need to re-type-check `bar`,
76-
but you don't think you should have to. In that case, you might do:
75+
Perhaps you are finding that when you change `foo` you need to re-type-check
76+
`bar`, but you don't think you should have to. In that case, you might do:
7777

7878
```
7979
RUST_DEP_GRAPH_FILTER='Hir & foo -> TypeckTables & bar'

src/mir-borrowck.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ enforcing a number of properties:
66
- That all variables are initialized before they are used.
77
- That you can't move the same value twice.
88
- That you can't move a value while it is borrowed.
9-
- That you can't access a place while it is mutably borrowed (except through the reference).
9+
- That you can't access a place while it is mutably borrowed (except through
10+
the reference).
1011
- That you can't mutate a place while it is shared borrowed.
1112
- etc
1213

@@ -44,10 +45,12 @@ The overall flow of the borrow checker is as follows:
4445
Among other things, this function will replace all of the regions in
4546
the MIR with fresh [inference variables](./appendix-glossary.html).
4647
- (More details can be found in [the regionck section](./mir-regionck.html).)
47-
- Next, we perform a number of [dataflow analyses](./appendix-background.html#dataflow)
48+
- Next, we perform a number of [dataflow
49+
analyses](./appendix-background.html#dataflow)
4850
that compute what data is moved and when. The results of these analyses
4951
are needed to do both borrow checking and region inference.
50-
- Using the move data, we can then compute the values of all the regions in the MIR.
52+
- Using the move data, we can then compute the values of all the regions in the
53+
MIR.
5154
- (More details can be found in [the NLL section](./mir-regionck.html).)
5255
- Finally, the borrow checker itself runs, taking as input (a) the
5356
results of move analysis and (b) the regions computed by the region

src/mir-passes.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ transformations. These suites represent useful intermediate points
1515
where we want to access the MIR for type checking or other purposes:
1616

1717
- `mir_build(D)` – not a query, but this constructs the initial MIR
18-
- `mir_const(D)` – applies some simple transformations to make MIR ready for constant evaluation;
19-
- `mir_validated(D)` – applies some more transformations, making MIR ready for borrow checking;
20-
- `optimized_mir(D)` – the final state, after all optimizations have been performed.
18+
- `mir_const(D)` – applies some simple transformations to make MIR ready for
19+
constant evaluation;
20+
- `mir_validated(D)` – applies some more transformations, making MIR ready for
21+
borrow checking;
22+
- `optimized_mir(D)` – the final state, after all optimizations have been
23+
performed.
2124

2225
### Seeing how the MIR changes as the compiler executes
2326

24-
`-Zdump-mir=F` is a handy compiler options that will let you view the MIR
25-
for each function at each stage of compilation. `-Zdump-mir` takes a **filter**
26-
`F` which allows you to control which functions and which passes you are interesting
27-
in. For example:
27+
`-Zdump-mir=F` is a handy compiler options that will let you view the MIR for
28+
each function at each stage of compilation. `-Zdump-mir` takes a **filter** `F`
29+
which allows you to control which functions and which passes you are
30+
interesting in. For example:
2831

2932
```bash
3033
> rustc -Zdump-mir=foo ...
@@ -58,8 +61,9 @@ rustc.main.000-000.CleanEndRegions.after.mir
5861
def-path to the function etc being dumped
5962
```
6063

61-
You can also make more selective filters. For example, `main & CleanEndRegions` will select
62-
for things that reference *both* `main` and the pass `CleanEndRegions`:
64+
You can also make more selective filters. For example, `main & CleanEndRegions`
65+
will select for things that reference *both* `main` and the pass
66+
`CleanEndRegions`:
6367

6468
```bash
6569
> rustc -Zdump-mir='main & CleanEndRegions' foo.rs

src/mir-regionck.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,15 @@ variable `'?3`, but the variable `'?3` is not forced to outlive
418418
anything else. Therefore, it simply starts and ends as the empty set
419419
of elements, and hence the type-check succeeds here.
420420

421-
(This should surprise you a little. It surprised me when I first
422-
realized it. We are saying that if we are a fn that **needs both of
423-
its arguments to have the same region**, we can accept being called
424-
with **arguments with two distinct regions**. That seems intuitively
425-
unsound. But in fact, it's fine, as I
426-
[tried to explain in this issue on the Rust issue tracker long ago][ohdeargoditsallbroken].
427-
The reason is that even if we get called with arguments of two
428-
distinct lifetimes, those two lifetimes have some intersection (the
429-
call itself), and that intersection can be our value of `'a` that we
430-
use as the common lifetime of our arguments. -nmatsakis)
421+
(This should surprise you a little. It surprised me when I first realized it.
422+
We are saying that if we are a fn that **needs both of its arguments to have
423+
the same region**, we can accept being called with **arguments with two
424+
distinct regions**. That seems intuitively unsound. But in fact, it's fine, as
425+
I tried to explain in [this issue][ohdeargoditsallbroken] on the Rust issue
426+
tracker long ago. The reason is that even if we get called with arguments of
427+
two distinct lifetimes, those two lifetimes have some intersection (the call
428+
itself), and that intersection can be our value of `'a` that we use as the
429+
common lifetime of our arguments. -nmatsakis)
431430

432431
[ohdeargoditsallbroken]: https://github.com/rust-lang/rust/issues/32330#issuecomment-202536977
433432

@@ -440,10 +439,10 @@ a return type:
440439
<:
441440
for<'b, 'c> fn(&'b u32, &'c u32) -> &'b u32
442441

443-
Despite seeming very similar to the previous example, this case is
444-
going to get an error. That's good: the problem is that we've gone
445-
from a fn that promises to return one of its two arguments, to a fn
446-
that is promising to return the first one. That is unsound. Let's see how it plays out.
442+
Despite seeming very similar to the previous example, this case is going to get
443+
an error. That's good: the problem is that we've gone from a fn that promises
444+
to return one of its two arguments, to a fn that is promising to return the
445+
first one. That is unsound. Let's see how it plays out.
447446

448447
First, we skolemize the supertype:
449448

@@ -463,8 +462,8 @@ And now we create the subtyping relationships:
463462
&'!2 u32 <: &'?3 u32 // arg 2
464463
&'?3 u32 <: &'!1 u32 // return type
465464

466-
And finally the outlives relationships. Here, let V1, V2, and V3 be the variables
467-
we assign to `!1`, `!2`, and `?3` respectively:
465+
And finally the outlives relationships. Here, let V1, V2, and V3 be the
466+
variables we assign to `!1`, `!2`, and `?3` respectively:
468467

469468
V1: V3
470469
V2: V3
@@ -476,8 +475,8 @@ Those variables will have these initial values:
476475
V2 in U2 = {skol(2)}
477476
V3 in U2 = {}
478477

479-
Now because of the `V3: V1` constraint, we have to add `skol(1)` into `V3` (and indeed
480-
it is visible from `V3`), so we get:
478+
Now because of the `V3: V1` constraint, we have to add `skol(1)` into `V3` (and
479+
indeed it is visible from `V3`), so we get:
481480

482481
V3 in U2 = {skol(1)}
483482

src/mir.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ This section introduces the key concepts of MIR, summarized here:
3434

3535
- **Basic blocks**: units of the control-flow graph, consisting of:
3636
- **statements:** actions with one successor
37-
- **terminators:** actions with potentially multiple successors; always at the end of a block
38-
- (if you're not familiar with the term *basic block*, see the [background chapter][cfg])
37+
- **terminators:** actions with potentially multiple successors; always at
38+
the end of a block
39+
- (if you're not familiar with the term *basic block*, see the [background
40+
chapter][cfg])
3941
- **Locals:** Memory locations alloated on the stack (conceptually, at
4042
least), such as function arguments, local variables, and
4143
temporaries. These are identified by an index, written with a
4244
leading underscore, like `_1`. There is also a special "local"
4345
(`_0`) allocated to store the return value.
44-
- **Places:** expressions that identify a ___location in memory, like `_1` or `_1.f`.
46+
- **Places:** expressions that identify a ___location in memory, like `_1` or
47+
`_1.f`.
4548
- **Rvalues:** expressions that produce a value. The "R" stands for
4649
the fact that these are the "right-hand side" of an assignment.
4750
- **Operands:** the arguments to an rvalue, which can either be a
@@ -100,8 +103,9 @@ you their original name (`// "vec" in scope 1...`). The "scope" blocks
100103
(e.g., `scope 1 { .. }`) describe the lexical structure of the source
101104
program (which names were in scope when).
102105

103-
**Basic blocks.** Reading further, we see our first **basic block** (naturally it may look
104-
slightly different when you view it, and I am ignoring some of the comments):
106+
**Basic blocks.** Reading further, we see our first **basic block** (naturally
107+
it may look slightly different when you view it, and I am ignoring some of the
108+
comments):
105109

106110
```
107111
bb0: {
@@ -110,8 +114,8 @@ bb0: {
110114
}
111115
```
112116

113-
A basic block is defined by a series of **statements** and a final **terminator**.
114-
In this case, there is one statement:
117+
A basic block is defined by a series of **statements** and a final
118+
**terminator**. In this case, there is one statement:
115119

116120
```
117121
StorageLive(_1);
@@ -146,8 +150,8 @@ bb2: {
146150
}
147151
```
148152

149-
Here there are two statements: another `StorageLive`, introducing the `_3` temporary,
150-
and then an assignment:
153+
Here there are two statements: another `StorageLive`, introducing the `_3`
154+
temporary, and then an assignment:
151155

152156
```
153157
_3 = &mut _1;
@@ -189,7 +193,8 @@ TMP1 = a + b
189193
x = TMP1 + c
190194
```
191195

192-
([Try it and see, though you may want to do release mode to skip over the overflow checks.][play-abc])
196+
([Try it and see][play-abc], though you may want to do release mode to skip
197+
over the overflow checks.)
193198

194199
[play-abc]: https://play.rust-lang.org/?gist=1751196d63b2a71f8208119e59d8a5b6&version=stable
195200

0 commit comments

Comments
 (0)