Skip to content

Commit bd347df

Browse files
nikomatsakismark-i-m
authored andcommitted
adjust overview slightly
1 parent 472f4e8 commit bd347df

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/borrow_check/region_inference.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ The MIR-based region analysis consists of two major functions:
2424
- [`compute_regions`], invoked second: this is given as argument the
2525
results of move analysis. It has the job of computing values for all
2626
the inference variables that `replace_regions_in_mir` introduced.
27-
- To do that, it first runs the [MIR type checker]. This
28-
is basically a normal type-checker but specialized to MIR, which
29-
is much simpler than full Rust, of course. Running the MIR type
30-
checker will however create **outlives constraints** between
31-
region variables (e.g., that one variable must outlive another
32-
one) to reflect the subtyping relationships that arise.
33-
- It also adds **liveness constraints** that arise from where variables
34-
are used.
35-
- After this, we create a [`RegionInferenceContext`] with the constraints we
36-
have computed and the inference variables we introduced and use the
37-
[`solve`] method to infer values for all region inference varaibles.
27+
- To do that, it first runs the [MIR type checker]. This is
28+
basically a normal type-checker but specialized to MIR, which is
29+
much simpler than full Rust, of course. Running the MIR type
30+
checker will however create various [constraints][cp] between region
31+
variables, indicating their potential values and relationships to
32+
one another.
33+
- After this, we perform [constraint propagation][cp] by creating a
34+
[`RegionInferenceContext`] and invoking its [`solve`]
35+
method.
3836
- The [NLL RFC] also includes fairly thorough (and hopefully readable)
3937
coverage.
4038

39+
[cp]: ./region_inference/constraint_propagation.html
4140
[fvb]: ../appendix/background.html#free-vs-bound
4241
[`replace_regions_in_mir`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.replace_regions_in_mir.html
4342
[`compute_regions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.compute_regions.html
@@ -105,8 +104,10 @@ The kinds of region elements are as follows:
105104

106105
## Constraints
107106

108-
Before we can infer the value of regions, we need to collect constraints on the
109-
regions. There are two primary types of constraints.
107+
Before we can infer the value of regions, we need to collect
108+
constraints on the regions. The full set of constraints is described
109+
in [the section on constraint propagation][cp], but the two most
110+
common sorts of constraints are:
110111

111112
1. Outlives constraints. These are constraints that one region outlives another
112113
(e.g. `'a: 'b`). Outlives constraints are generated by the [MIR type

0 commit comments

Comments
 (0)