[canonicalization] fix result canonicalization example
This commit is contained in:
parent
52b2f710f8
commit
31c4046c5a
|
|
@ -173,7 +173,7 @@ variables have unbound inference variables in their type: `?T`
|
||||||
represents the elements in the vector `t` and `?U` represents the
|
represents the elements in the vector `t` and `?U` represents the
|
||||||
value stored in the option `u`. Next, we invoke `foo`; comparing the
|
value stored in the option `u`. Next, we invoke `foo`; comparing the
|
||||||
signature of `foo` to its arguments, we wind up with `A = Vec<?T>` and
|
signature of `foo` to its arguments, we wind up with `A = Vec<?T>` and
|
||||||
`B = ?U`.Therefore, the where clause on `foo` requires that `Vec<?T>:
|
`B = ?U`. Therefore, the where clause on `foo` requires that `Vec<?T>:
|
||||||
Borrow<?U>`. This is thus our first example trait query.
|
Borrow<?U>`. This is thus our first example trait query.
|
||||||
|
|
||||||
There are many possible solutions to the query `Vec<?T>: Borrow<?U>`;
|
There are many possible solutions to the query `Vec<?T>: Borrow<?U>`;
|
||||||
|
|
|
||||||
|
|
@ -177,8 +177,8 @@ The result would be as follows:
|
||||||
```text
|
```text
|
||||||
Canonical(QR) = for<T, L> {
|
Canonical(QR) = for<T, L> {
|
||||||
certainty: Proven,
|
certainty: Proven,
|
||||||
var_values: [Vec<?0>, '?1, ?2]
|
var_values: [Vec<?0>, '?1, ?0]
|
||||||
region_constraints: [?2: '?1],
|
region_constraints: [?0: '?1],
|
||||||
value: (),
|
value: (),
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -213,8 +213,8 @@ and now we got back a canonical response:
|
||||||
```text
|
```text
|
||||||
for<T, L> {
|
for<T, L> {
|
||||||
certainty: Proven,
|
certainty: Proven,
|
||||||
var_values: [Vec<?0>, '?1, ?2]
|
var_values: [Vec<?0>, '?1, ?0]
|
||||||
region_constraints: [?2: '?1],
|
region_constraints: [?0: '?1],
|
||||||
value: (),
|
value: (),
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -250,7 +250,7 @@ for later verification.
|
||||||
than eagerly instantiating all of the canonical values in the result
|
than eagerly instantiating all of the canonical values in the result
|
||||||
with variables, we instead walk the vector of values, looking for
|
with variables, we instead walk the vector of values, looking for
|
||||||
cases where the value is just a canonical variable. In our example,
|
cases where the value is just a canonical variable. In our example,
|
||||||
`values[2]` is `?C`, so that means we can deduce that `?C := ?B and
|
`values[2]` is `?C`, so that means we can deduce that `?C := ?B` and
|
||||||
`'?D := 'static`. This gives us a partial set of values. Anything for
|
`'?D := 'static`. This gives us a partial set of values. Anything for
|
||||||
which we do not find a value, we create an inference variable.)
|
which we do not find a value, we create an inference variable.)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue