Skip to content

Commit 2debb43

Browse files
tmandrymark-i-m
authored andcommitted
Clarify language in Trait Resolution
1 parent 50f4421 commit 2debb43

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/trait-resolution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ impl<T:Get> Get for Box<T> {
202202

203203
What happens when we invoke `get_it(&Box::new(1_u16))`, for example? In this
204204
case, the `Self` type is `Box<u16>` – that unifies with both impls,
205-
because the first applies to all types, and the second to all
206-
boxes. In order for this to be unambiguous, the compiler does a *winnowing*
205+
because the first applies to all types `T`, and the second to all
206+
`Box<T>`. In order for this to be unambiguous, the compiler does a *winnowing*
207207
pass that considers `where` clauses
208208
and attempts to remove candidates. In this case, the first impl only
209209
applies if `Box<u16> : Copy`, which doesn't hold. After winnowing,
@@ -242,7 +242,7 @@ fn foo<X:A2+B>(x: X) {
242242

243243
In the body of `foo`, clearly we can use methods of `A1`, `A2`, or `B`
244244
on variable `x`. The line marked `(*)` will incur an obligation `X: A1`,
245-
which the line marked `(#)` will incur an obligation `X: B`. Meanwhile,
245+
while the line marked `(#)` will incur an obligation `X: B`. Meanwhile,
246246
the parameter environment will contain two where-clauses: `X : A2` and `X : B`.
247247
For each obligation, then, we search this list of where-clauses. The
248248
obligation `X: B` trivially matches against the where-clause `X: B`.

0 commit comments

Comments
 (0)