@@ -149,7 +149,7 @@ To allow for this, the inference context supports a `snapshot` method.
149
149
When you call it, it will start recording changes that occur from the
150
150
operations you perform. When you are done, you can either invoke
151
151
` rollback_to ` , which will undo those changes, or else ` confirm ` , which
152
- will make the permanent. Snapshots can be nested as long as you follow
152
+ will make them permanent. Snapshots can be nested as long as you follow
153
153
a stack-like discipline.
154
154
155
155
Rather than use snapshots directly, it is often helpful to use the
@@ -200,7 +200,7 @@ idea:
200
200
```
201
201
202
202
(There are various other kinds of constraints, such as "verifys"; see
203
- the ` region_constraints ` module for details.)
203
+ the [ ` region_constraints ` ] module for details.)
204
204
205
205
There is one case where we do some amount of eager unification. If you have an
206
206
equality constraint between two regions
@@ -210,10 +210,13 @@ equality constraint between two regions
210
210
```
211
211
212
212
we will record that fact in a unification table. You can then use
213
- ` opportunistic_resolve_var ` to convert ` 'b ` to ` 'a ` (or vice
213
+ [ ` opportunistic_resolve_var ` ] to convert ` 'b ` to ` 'a ` (or vice
214
214
versa). This is sometimes needed to ensure termination of fixed-point
215
215
algorithms.
216
216
217
+ [ `region_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/region_constraints/index.html
218
+ [ `opportunistic_resolve_var` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/region_constraints/struct.RegionConstraintCollector.html#method.opportunistic_resolve_var
219
+
217
220
## Extracting region constraints
218
221
219
222
Ultimately, region constraints are only solved at the very end of
@@ -222,22 +225,27 @@ ways to solve region constraints right now: lexical and
222
225
non-lexical. Eventually there will only be one.
223
226
224
227
To solve ** lexical** region constraints, you invoke
225
- ` resolve_regions_and_report_errors ` . This "closes" the region
226
- constraint process and invoke the ` lexical_region_resolve ` code. Once
228
+ [ ` resolve_regions_and_report_errors ` ] . This "closes" the region
229
+ constraint process and invokes the [ ` lexical_region_resolve ` ] code. Once
227
230
this is done, any further attempt to equate or create a subtyping
228
231
relationship will yield an ICE.
229
232
230
233
Non-lexical region constraints are not handled within the inference
231
234
context. Instead, the NLL solver (actually, the MIR type-checker)
232
- invokes ` take_and_reset_region_constraints ` periodically. This
235
+ invokes [ ` take_and_reset_region_constraints ` ] periodically. This
233
236
extracts all of the outlives constraints from the region solver, but
234
237
leaves the set of variables intact. This is used to get * just* the
235
238
region constraints that resulted from some particular point in the
236
239
program, since the NLL solver needs to know not just * what* regions
237
- were subregions but * where* . Finally, the NLL solver invokes
238
- ` take_region_var_origins ` , which "closes" the region constraint
240
+ were subregions, but also * where* . Finally, the NLL solver invokes
241
+ [ ` take_region_var_origins ` ] , which "closes" the region constraint
239
242
process in the same way as normal solving.
240
243
244
+ [ `resolve_regions_and_report_errors` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.resolve_regions_and_report_errors
245
+ [ `lexical_region_resolve` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/lexical_region_resolve/index.html
246
+ [ `take_and_reset_region_constraints` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.take_and_reset_region_constraints
247
+ [ `take_region_var_origins` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.take_region_var_origins
248
+
241
249
## Lexical region resolution
242
250
243
251
Lexical region resolution is done by initially assigning each region
0 commit comments