diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2018-05-11 21:06:21 -0500 |
|---|---|---|
| committer | Who? Me?! <mark-i-m@users.noreply.github.com> | 2018-05-27 16:11:27 -0500 |
| commit | bce2d112addc7a7c67369599a91b5eb8279ffd3b (patch) | |
| tree | 84f16a98d7f8d884eb3e23dd7a9acc20b681e216 /src/doc/rustc-dev-guide | |
| parent | dfd204e5e74543f4015418c78957f1d96dd26c5e (diff) | |
| download | rust-bce2d112addc7a7c67369599a91b5eb8279ffd3b.tar.gz rust-bce2d112addc7a7c67369599a91b5eb8279ffd3b.zip | |
Clarify language in Trait Resolution
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/trait-resolution.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/src/trait-resolution.md b/src/doc/rustc-dev-guide/src/trait-resolution.md index 5bf8f8716fc..b9fa81bd6c0 100644 --- a/src/doc/rustc-dev-guide/src/trait-resolution.md +++ b/src/doc/rustc-dev-guide/src/trait-resolution.md @@ -202,8 +202,8 @@ impl<T:Get> Get for Box<T> { What happens when we invoke `get_it(&Box::new(1_u16))`, for example? In this case, the `Self` type is `Box<u16>` – that unifies with both impls, -because the first applies to all types, and the second to all -boxes. In order for this to be unambiguous, the compiler does a *winnowing* +because the first applies to all types `T`, and the second to all +`Box<T>`. In order for this to be unambiguous, the compiler does a *winnowing* pass that considers `where` clauses and attempts to remove candidates. In this case, the first impl only applies if `Box<u16> : Copy`, which doesn't hold. After winnowing, @@ -242,7 +242,7 @@ fn foo<X:A2+B>(x: X) { In the body of `foo`, clearly we can use methods of `A1`, `A2`, or `B` on variable `x`. The line marked `(*)` will incur an obligation `X: A1`, -which the line marked `(#)` will incur an obligation `X: B`. Meanwhile, +while the line marked `(#)` will incur an obligation `X: B`. Meanwhile, the parameter environment will contain two where-clauses: `X : A2` and `X : B`. For each obligation, then, we search this list of where-clauses. The obligation `X: B` trivially matches against the where-clause `X: B`. |
