diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2018-03-09 04:19:36 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2018-03-10 07:06:48 -0500 |
| commit | 2c4cca82435b4b3f98c9af89550a306a2ca7425a (patch) | |
| tree | 8cfe57c8a997cfdf1d8bfbf5c57f885c362b37cb /src/doc | |
| parent | b0802ba5b4a630c2e9b2eb639cfe148f83a0ca03 (diff) | |
| download | rust-2c4cca82435b4b3f98c9af89550a306a2ca7425a.tar.gz rust-2c4cca82435b4b3f98c9af89550a306a2ca7425a.zip | |
don't say 'thing'
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/traits-canonicalization.md | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/src/traits-canonicalization.md b/src/doc/rustc-dev-guide/src/traits-canonicalization.md index 35352d60528..8ab73a7ffa0 100644 --- a/src/doc/rustc-dev-guide/src/traits-canonicalization.md +++ b/src/doc/rustc-dev-guide/src/traits-canonicalization.md @@ -2,13 +2,15 @@ Canonicalization is the process of **isolating** an inference value from its context. It is really based on a very simple concept: every -[inference variable](./type-inference.html#vars) is always in one of two -states: either it is **unbound**, in which case we don't know yet what -type it is, or it is **bound**, in which case we do. So to isolate -some thing T from its environment, we just walk down and find the -unbound variables that appear in T; those variables get renumbered in -a canonical order (left to right, for the most part, but really it -doesn't matter as long as it is consistent). +[inference variable](./type-inference.html#vars) is always in one of +two states: either it is **unbound**, in which case we don't know yet +what type it is, or it is **bound**, in which case we do. So to +isolate some data-structure T that contains types/regions from its +environment, we just walk down and find the unbound variables that +appear in T; those variables get replaced with "canonical variables", +starting from zero and numbered in a fixed order (left to right, for +the most part, but really it doesn't matter as long as it is +consistent). So, for example, if we have the type `X = (?T, ?U)`, where `?T` and `?U` are distinct, unbound inference variables, then the canonical |
