@@ -9,7 +9,7 @@ deprecated once they become the standard kind of lifetime.)
99
1010The MIR-based region analysis consists of two major functions:
1111
12- - ` replace_regions_in_mir ` , invoked first, has two jobs:
12+ - [ ` replace_regions_in_mir ` ] , invoked first, has two jobs:
1313 - First, it finds the set of regions that appear within the
1414 signature of the function (e.g., ` 'a ` in `fn foo<'a>(&'a u32) {
1515 ... }`). These are called the "universal" or "free" regions – in
@@ -21,21 +21,28 @@ The MIR-based region analysis consists of two major functions:
2121 not of much interest. The intention is that – eventually – they
2222 will be "erased regions" (i.e., no information at all), since we
2323 won't be doing lexical region inference at all.
24- - ` compute_regions ` , invoked second: this is given as argument the
24+ - [ ` 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.
2727 - To do that, it first runs the [ MIR type checker] ( #mirtypeck ) . This
2828 is basically a normal type-checker but specialized to MIR, which
29- is much simpler than full Rust of course. Running the MIR type
29+ is much simpler than full Rust, of course. Running the MIR type
3030 checker will however create ** outlives constraints** between
3131 region variables (e.g., that one variable must outlive another
3232 one) to reflect the subtyping relationships that arise.
3333 - It also adds ** liveness constraints** that arise from where variables
3434 are used.
35- - More details to come, though the [ NLL RFC] also includes fairly thorough
36- (and hopefully readable) coverage.
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.
38+ - The [ NLL RFC] also includes fairly thorough (and hopefully readable)
39+ coverage.
3740
3841[ fvb ] : ../appendix/background.html#free-vs-bound
42+ [ `replace_regions_in_mir` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.replace_regions_in_mir.html
43+ [ `compute_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.compute_regions.html
44+ [ `RegionInferenceContext` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/region_infer/struct.RegionInferenceContext.html
45+ [ `solve` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/region_infer/struct.RegionInferenceContext.html#method.solve
3946[ NLL RFC ] : http://rust-lang.github.io/rfcs/2094-nll.html
4047
4148## Universal regions
0 commit comments