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