Skip to content

Commit 37e4af3

Browse files
authored
Merge pull request #304 from rasendubi/fix-canonicalization
[canonicalization] fix result canonicalization example
2 parents 2b8280f + a0ab5fa commit 37e4af3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/traits/canonical-queries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ variables have unbound inference variables in their type: `?T`
173173
represents the elements in the vector `t` and `?U` represents the
174174
value stored in the option `u`. Next, we invoke `foo`; comparing the
175175
signature of `foo` to its arguments, we wind up with `A = Vec<?T>` and
176-
`B = ?U`.Therefore, the where clause on `foo` requires that `Vec<?T>:
176+
`B = ?U`. Therefore, the where clause on `foo` requires that `Vec<?T>:
177177
Borrow<?U>`. This is thus our first example trait query.
178178

179179
There are many possible solutions to the query `Vec<?T>: Borrow<?U>`;

src/traits/canonicalization.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ The result would be as follows:
177177
```text
178178
Canonical(QR) = for<T, L> {
179179
certainty: Proven,
180-
var_values: [Vec<?0>, '?1, ?2]
181-
region_constraints: [?2: '?1],
180+
var_values: [Vec<?0>, '?1, ?0]
181+
region_constraints: [?0: '?1],
182182
value: (),
183183
}
184184
```
@@ -213,8 +213,8 @@ and now we got back a canonical response:
213213
```text
214214
for<T, L> {
215215
certainty: Proven,
216-
var_values: [Vec<?0>, '?1, ?2]
217-
region_constraints: [?2: '?1],
216+
var_values: [Vec<?0>, '?1, ?0]
217+
region_constraints: [?0: '?1],
218218
value: (),
219219
}
220220
```
@@ -250,7 +250,7 @@ for later verification.
250250
than eagerly instantiating all of the canonical values in the result
251251
with variables, we instead walk the vector of values, looking for
252252
cases where the value is just a canonical variable. In our example,
253-
`values[2]` is `?C`, so that means we can deduce that `?C := ?B and
253+
`values[2]` is `?C`, so that means we can deduce that `?C := ?B` and
254254
`'?D := 'static`. This gives us a partial set of values. Anything for
255255
which we do not find a value, we create an inference variable.)
256256

0 commit comments

Comments
 (0)