11# Region inference (NLL)
22
3- The MIR-based region checking code is located in
4- [ the ` rustc_mir::borrow_check::nll ` module] [ nll ] . (NLL, of course,
5- stands for "non-lexical lifetimes", a term that will hopefully be
6- deprecated once they become the standard kind of lifetime.)
3+ The MIR-based region checking code is located in [ the ` rustc_mir::borrow_check `
4+ module] [ nll ] .
75
8- [ nll ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ index.html
6+ [ nll ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/index.html
97
108The MIR-based region analysis consists of two major functions:
119
@@ -36,12 +34,12 @@ The MIR-based region analysis consists of two major functions:
3634 - The [ NLL RFC] also includes fairly thorough (and hopefully readable)
3735 coverage.
3836
39- [ cp ] : ./region_inference/constraint_propagation.html
40- [ fvb ] : ../appendix/background.html #free-vs-bound
37+ [ cp ] : ./region_inference/constraint_propagation.md
38+ [ fvb ] : ../appendix/background.md #free-vs-bound
4139[ `replace_regions_in_mir` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.replace_regions_in_mir.html
4240[ `compute_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/fn.compute_regions.html
43- [ `RegionInferenceContext` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html
44- [ `solve` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#method.solve
41+ [ `RegionInferenceContext` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html
42+ [ `solve` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#method.solve
4543[ NLL RFC ] : https://rust-lang.github.io/rfcs/2094-nll.html
4644[ MIR type checker ] : ./type_check.md
4745
@@ -68,7 +66,7 @@ the moment.
6866
6967TODO: write about _ how_ these regions are computed.
7068
71- [ `UniversalRegions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ universal_regions/struct.UniversalRegions.html
69+ [ `UniversalRegions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/universal_regions/struct.UniversalRegions.html
7270
7371<a name =" region-variables " ></a >
7472
@@ -84,7 +82,7 @@ maintain a set storing what elements are present in its value (to make this
8482efficient, we give each kind of element an index, the ` RegionElementIndex ` , and
8583use sparse bitsets).
8684
87- [ ri ] : https://github.com/rust-lang/rust/tree/master/src/librustc_mir/borrow_check/nll/ region_infer/
85+ [ ri ] : https://github.com/rust-lang/rust/tree/master/src/librustc_mir/borrow_check/region_infer/
8886
8987The kinds of region elements are as follows:
9088
@@ -115,7 +113,7 @@ common sorts of constraints are:
1151132 . Liveness constraints. Each region needs to be live at points where it can be
116114 used. These constraints are collected by [ ` generate_constraints ` ] .
117115
118- [ `generate_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ constraint_generation/fn.generate_constraints.html
116+ [ `generate_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/constraint_generation/fn.generate_constraints.html
119117
120118## Inference Overview
121119
@@ -219,12 +217,12 @@ Here are some of the fields of the struct:
219217- [ ` closure_bounds_mapping ` ] : used for propagating region constraints from
220218 closures back out to the creator of the closure.
221219
222- [ `constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.constraints
223- [ `liveness_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.liveness_constraints
224- [ `universal_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.universal_regions
225- [ `universal_region_relations` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.universal_region_relations
226- [ `type_tests` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.type_tests
227- [ `closure_bounds_mapping` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#structfield.closure_bounds_mapping
220+ [ `constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.constraints
221+ [ `liveness_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.liveness_constraints
222+ [ `universal_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.universal_regions
223+ [ `universal_region_relations` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.universal_region_relations
224+ [ `type_tests` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.type_tests
225+ [ `closure_bounds_mapping` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#structfield.closure_bounds_mapping
228226
229227TODO: should we discuss any of the others fields? What about the SCCs?
230228
@@ -233,6 +231,6 @@ inference. This is done by calling the [`solve`] method on the context. This
233231is where we call [ ` propagate_constraints ` ] and then check the resulting type
234232tests and universal regions, as discussed above.
235233
236- [ `propagate_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#method.propagate_constraints
237- [ `check_type_tests` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#method.check_type_tests
238- [ `check_universal_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/nll/ region_infer/struct.RegionInferenceContext.html#method.check_universal_regions
234+ [ `propagate_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#method.propagate_constraints
235+ [ `check_type_tests` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#method.check_type_tests
236+ [ `check_universal_regions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/region_infer/struct.RegionInferenceContext.html#method.check_universal_regions
0 commit comments