@@ -9,7 +9,7 @@ deprecated once they become the standard kind of lifetime.)
9
9
10
10
The MIR-based region analysis consists of two major functions:
11
11
12
- - ` replace_regions_in_mir ` , invoked first, has two jobs:
12
+ - [ ` replace_regions_in_mir ` ] , invoked first, has two jobs:
13
13
- First, it finds the set of regions that appear within the
14
14
signature of the function (e.g., ` 'a ` in `fn foo<'a>(&'a u32) {
15
15
... }`). These are called the "universal" or "free" regions – in
@@ -21,21 +21,28 @@ The MIR-based region analysis consists of two major functions:
21
21
not of much interest. The intention is that – eventually – they
22
22
will be "erased regions" (i.e., no information at all), since we
23
23
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
25
25
results of move analysis. It has the job of computing values for all
26
26
the inference variables that ` replace_regions_in_mir ` introduced.
27
27
- To do that, it first runs the [ MIR type checker] ( #mirtypeck ) . This
28
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
29
+ is much simpler than full Rust, of course. Running the MIR type
30
30
checker will however create ** outlives constraints** between
31
31
region variables (e.g., that one variable must outlive another
32
32
one) to reflect the subtyping relationships that arise.
33
33
- It also adds ** liveness constraints** that arise from where variables
34
34
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.
37
40
38
41
[ 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
39
46
[ NLL RFC ] : http://rust-lang.github.io/rfcs/2094-nll.html
40
47
41
48
## Universal regions
0 commit comments