Skip to content

Commit acf098b

Browse files
authored
Merge branch 'master' into resolver-moved
2 parents c5bc5c6 + 498f7bd commit acf098b

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/name-resolution.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ source to relevant places where the name was introduced. It also generates
2828
helpful error messages, like typo suggestions, traits to import or lints about
2929
unused items.
3030

31-
A successful run of the second phase (`Resolver::resolve_crate`) creates kind
31+
A successful run of the second phase ([`Resolver::resolve_crate`]) creates kind
3232
of an index the rest of the compilation may use to ask about the present names
3333
(through the `hir::lowering::Resolver` interface).
3434

3535
The name resolution lives in the `librustc_resolve` crate, with the meat in
3636
`lib.rs` and some helpers or symbol-type specific logic in the other modules.
3737

3838
[`Resolver`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/trait.Resolver.html
39+
[`Resolver::resolve_crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/struct.Resolver.html#method.resolve_crate
3940

4041
## Namespaces
4142

src/type-inference.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ To allow for this, the inference context supports a `snapshot` method.
149149
When you call it, it will start recording changes that occur from the
150150
operations you perform. When you are done, you can either invoke
151151
`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
153153
a stack-like discipline.
154154

155155
Rather than use snapshots directly, it is often helpful to use the
@@ -200,7 +200,7 @@ idea:
200200
```
201201

202202
(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.)
204204

205205
There is one case where we do some amount of eager unification. If you have an
206206
equality constraint between two regions
@@ -210,10 +210,13 @@ equality constraint between two regions
210210
```
211211

212212
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
214214
versa). This is sometimes needed to ensure termination of fixed-point
215215
algorithms.
216216

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+
217220
## Extracting region constraints
218221

219222
Ultimately, region constraints are only solved at the very end of
@@ -222,22 +225,27 @@ ways to solve region constraints right now: lexical and
222225
non-lexical. Eventually there will only be one.
223226

224227
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
227230
this is done, any further attempt to equate or create a subtyping
228231
relationship will yield an ICE.
229232

230233
Non-lexical region constraints are not handled within the inference
231234
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
233236
extracts all of the outlives constraints from the region solver, but
234237
leaves the set of variables intact. This is used to get *just* the
235238
region constraints that resulted from some particular point in the
236239
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
239242
process in the same way as normal solving.
240243

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+
241249
## Lexical region resolution
242250

243251
Lexical region resolution is done by initially assigning each region

0 commit comments

Comments
 (0)