adjust overview slightly

This commit is contained in:
Niko Matsakis 2019-06-20 09:51:11 -04:00 committed by Who? Me?!
parent 472f4e8367
commit bd347df751
1 changed files with 14 additions and 13 deletions

View File

@ -24,20 +24,19 @@ The MIR-based region analysis consists of two major functions:
- [`compute_regions`], invoked second: this is given as argument the
results of move analysis. It has the job of computing values for all
the inference variables that `replace_regions_in_mir` introduced.
- To do that, it first runs the [MIR type checker]. This
is basically a normal type-checker but specialized to MIR, which
is much simpler than full Rust, of course. Running the MIR type
checker will however create **outlives constraints** between
region variables (e.g., that one variable must outlive another
one) to reflect the subtyping relationships that arise.
- It also adds **liveness constraints** that arise from where variables
are used.
- After this, we create a [`RegionInferenceContext`] with the constraints we
have computed and the inference variables we introduced and use the
[`solve`] method to infer values for all region inference varaibles.
- To do that, it first runs the [MIR type checker]. This is
basically a normal type-checker but specialized to MIR, which is
much simpler than full Rust, of course. Running the MIR type
checker will however create various [constraints][cp] between region
variables, indicating their potential values and relationships to
one another.
- After this, we perform [constraint propagation][cp] by creating a
[`RegionInferenceContext`] and invoking its [`solve`]
method.
- The [NLL RFC] also includes fairly thorough (and hopefully readable)
coverage.
[cp]: ./region_inference/constraint_propagation.html
[fvb]: ../appendix/background.html#free-vs-bound
[`replace_regions_in_mir`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.replace_regions_in_mir.html
[`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:
## Constraints
Before we can infer the value of regions, we need to collect constraints on the
regions. There are two primary types of constraints.
Before we can infer the value of regions, we need to collect
constraints on the regions. The full set of constraints is described
in [the section on constraint propagation][cp], but the two most
common sorts of constraints are:
1. Outlives constraints. These are constraints that one region outlives another
(e.g. `'a: 'b`). Outlives constraints are generated by the [MIR type