about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
authorTshepang Lekhonkhobe <tshepang@gmail.com>2020-04-01 10:52:31 +0200
committerGitHub <noreply@github.com>2020-04-01 10:52:31 +0200
commit22ee98a04a732dc92f8b61fb90e3fa578dd2d4e8 (patch)
tree717178a5aade00ebd6225ebdba9b71203e31b735 /src/doc/rustc-dev-guide
parentbebaeaab763a56c17d7f9dfe9b3d5977c03938de (diff)
downloadrust-22ee98a04a732dc92f8b61fb90e3fa578dd2d4e8.tar.gz
rust-22ee98a04a732dc92f8b61fb90e3fa578dd2d4e8.zip
add some type inference links, and fix/improve some stuff (#654)
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rw-r--r--src/doc/rustc-dev-guide/src/type-inference.md24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/doc/rustc-dev-guide/src/type-inference.md b/src/doc/rustc-dev-guide/src/type-inference.md
index dca93dbdf3f..9c548364d4c 100644
--- a/src/doc/rustc-dev-guide/src/type-inference.md
+++ b/src/doc/rustc-dev-guide/src/type-inference.md
@@ -149,7 +149,7 @@ To allow for this, the inference context supports a `snapshot` method.
 When you call it, it will start recording changes that occur from the
 operations you perform. When you are done, you can either invoke
 `rollback_to`, which will undo those changes, or else `confirm`, which
-will make the permanent. Snapshots can be nested as long as you follow
+will make them permanent. Snapshots can be nested as long as you follow
 a stack-like discipline.
 
 Rather than use snapshots directly, it is often helpful to use the
@@ -200,7 +200,7 @@ idea:
 ```
 
 (There are various other kinds of constraints, such as "verifys"; see
-the `region_constraints` module for details.)
+the [`region_constraints`] module for details.)
 
 There is one case where we do some amount of eager unification. If you have an
 equality constraint between two regions
@@ -210,10 +210,13 @@ equality constraint between two regions
 ```
 
 we will record that fact in a unification table. You can then use
-`opportunistic_resolve_var` to convert `'b` to `'a` (or vice
+[`opportunistic_resolve_var`] to convert `'b` to `'a` (or vice
 versa). This is sometimes needed to ensure termination of fixed-point
 algorithms.
 
+[`region_constraints`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/region_constraints/index.html
+[`opportunistic_resolve_var`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/region_constraints/struct.RegionConstraintCollector.html#method.opportunistic_resolve_var
+
 ## Extracting region constraints
 
 Ultimately, region constraints are only solved at the very end of
@@ -222,22 +225,27 @@ ways to solve region constraints right now: lexical and
 non-lexical. Eventually there will only be one.
 
 To solve **lexical** region constraints, you invoke
-`resolve_regions_and_report_errors`.  This "closes" the region
-constraint process and invoke the `lexical_region_resolve` code. Once
+[`resolve_regions_and_report_errors`].  This "closes" the region
+constraint process and invokes the [`lexical_region_resolve`] code. Once
 this is done, any further attempt to equate or create a subtyping
 relationship will yield an ICE.
 
 Non-lexical region constraints are not handled within the inference
 context. Instead, the NLL solver (actually, the MIR type-checker)
-invokes `take_and_reset_region_constraints` periodically. This
+invokes [`take_and_reset_region_constraints`] periodically. This
 extracts all of the outlives constraints from the region solver, but
 leaves the set of variables intact. This is used to get *just* the
 region constraints that resulted from some particular point in the
 program, since the NLL solver needs to know not just *what* regions
-were subregions but *where*. Finally, the NLL solver invokes
-`take_region_var_origins`, which "closes" the region constraint
+were subregions, but also *where*. Finally, the NLL solver invokes
+[`take_region_var_origins`], which "closes" the region constraint
 process in the same way as normal solving.
 
+[`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
+[`lexical_region_resolve`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/lexical_region_resolve/index.html
+[`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
+[`take_region_var_origins`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.take_region_var_origins
+
 ## Lexical region resolution
 
 Lexical region resolution is done by initially assigning each region