Skip to content

Commit 87382ba

Browse files
committed
address nits
1 parent d453fae commit 87382ba

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

src/borrow_check.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ the [`mir_borrowck`] query.
3838
[b_c]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/index.html
3939
[`mir_borrowck`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/fn.mir_borrowck.html
4040

41-
- We first create a **local copy** C of the MIR. In the coming steps,
41+
- We first create a **local copy** of the MIR. In the coming steps,
4242
we will modify this copy in place to modify the types and things to
4343
include references to the new regions that we are computing.
44-
- We then invoke [`replace_regions_in_mir`] to modify this copy C.
44+
- We then invoke [`replace_regions_in_mir`] to modify our local MIR.
4545
Among other things, this function will replace all of the [regions](./appendix/glossary.html) in
4646
the MIR with fresh [inference variables](./appendix/glossary.html).
4747
- Next, we perform a number of
@@ -51,7 +51,7 @@ the [`mir_borrowck`] query.
5151
the purpose of this type check is to determine all of the constraints between
5252
different regions.
5353
- Next, we do [region inference](borrow_check/region_inference.html), which computes
54-
the values of each region -- basically, points in the control-flow graph.
54+
the values of each region basically, points in the control-flow graph.
5555
- At this point, we can compute the "borrows in scope" at each point.
5656
- Finally, we do a second walk over the MIR, looking at the actions it
5757
does and reporting errors. For example, if we see a statement like

src/borrow_check/moves_and_initialization.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ value -- and moves -- transfering ownership to another place -- might
1111
seem like distinct topics. Indeed, our borrow checker error messages
1212
often talk about them differently. But **within the borrow checker**,
1313
they are not nearly as separate. Roughly speaking, the borrow checker
14-
tracks the set of "initialized places" at any point in time. Assigning
15-
to a previously uninitialized local variable adds it to that set;
16-
moving from a local variable removes it from that set.
14+
tracks the set of "initialized places" at any point in the source
15+
code. Assigning to a previously uninitialized local variable adds it
16+
to that set; moving from a local variable removes it from that set.
1717

1818
Consider this example:
1919

@@ -36,8 +36,8 @@ fn foo() {
3636
```
3737

3838
Here you can see that `a` starts off as uninitialized; once it is
39-
assigned, it becomes initialized. But when `drop(a)` is called, it
40-
becomes uninitialized again.
39+
assigned, it becomes initialized. But when `drop(a)` is called, that
40+
moves `a` into the call, and hence it becomes uninitialized again.
4141

4242
## Subsections
4343

@@ -47,4 +47,4 @@ subsections:
4747
- [Move paths](./moves_and_initialization/move_paths.html the
4848
*move path* concept that we use to track which local variables (or parts of
4949
local variables, in some cases) are initialized.
50-
- *Rest not yet written* =)
50+
- TODO *Rest not yet written* =)

src/borrow_check/moves_and_initialization/move_paths.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Move paths
22

33
In reality, it's not enough to track initialization at the granularity
4-
of local variables. Sometimes we need to track, e.g., individual fields:
4+
of local variables. Rust also allows us to do moves and initialization
5+
at the field granularity:
56

67
```rust
78
fn foo() {
@@ -63,9 +64,9 @@ later section.
6364

6465
### Illegal move paths
6566

66-
We don't actually move-paths for **every** [`Place`] that gets used.
67-
In particular, if it is illegal to move from a [`Place`], then there
68-
is no need for a [`MovePathIndex`]. Some examples:
67+
We don't actually create a move-path for **every** [`Place`] that gets
68+
used. In particular, if it is illegal to move from a [`Place`], then
69+
there is no need for a [`MovePathIndex`]. Some examples:
6970

7071
- You cannot move from a static variable, so we do not create a [`MovePathIndex`]
7172
for static variables.
@@ -115,11 +116,12 @@ they are also structured into a tree. So for example if you have the
115116
[`MovePathIndex`] for `a.b.c`, you can go to its parent move-path
116117
`a.b`. You can also iterate over all children paths: so, from `a.b`,
117118
you might iterate to find the path `a.b.c` (here you are iterating
118-
just over the paths that the user **actually referenced**, not all
119-
**possible** paths the user could have done). These references are
120-
used for example in the [`has_any_child_of`] function, which checks
121-
whether the dataflow results contain a value for the given move-path
122-
(e.g., `a.b`) or any child of that move-path (e.g., `a.b.c`).
119+
just over the paths that are **actually referenced** in the source,
120+
not all **possible** paths that could have been referenced). These
121+
references are used for example in the [`has_any_child_of`] function,
122+
which checks whether the dataflow results contain a value for the
123+
given move-path (e.g., `a.b`) or any child of that move-path (e.g.,
124+
`a.b.c`).
123125

124126
[`Place`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/enum.Place.html
125127
[`has_any_child_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/at_location/struct.FlowAtLocation.html#method.has_any_child_of

src/borrow_check/type_check.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ kind you might find in any other language. In the process of doing
77
this type-check, we also uncover the region constraints that apply to
88
the program.
99

10-
11-
10+
TODO -- elaborate further? Maybe? :)

0 commit comments

Comments
 (0)