Skip to content

Commit 7caf54b

Browse files
committed
Auto merge of #29505 - rjbs:docs-where-type, r=steveklabnik
I read this section a few times before even having a guess what was meant, then consulted IRC for confirmation. It may be that I was thick-headed, but I think this is a useful addition.
2 parents 9c2489b + 21a0c40 commit 7caf54b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/trpl/traits.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ fn inverse<T>() -> T
400400

401401
This shows off the additional feature of `where` clauses: they allow bounds
402402
where the left-hand side is an arbitrary type (`i32` in this case), not just a
403-
plain type parameter (like `T`).
403+
plain type parameter (like `T`). In this example, `i32` must implement
404+
`ConvertTo<T>`. Rather than defining what `i32` is (since that's obvious), the
405+
`where` clause here is a constraint on `T`.
404406

405407
# Default methods
406408

0 commit comments

Comments
 (0)