Rollup merge of #33747 - postmodern:patch-2, r=Manishearth

Clarify the English translation of `?Sized`

* It wasn't clear whether `?Sized` meant "not `Sized`" or "`Sized` or not `Sized`". According to #rust IRC, it does indeed mean "`Sized` or not `Sized`".
* Use the same language as [Trait std::marker::Sized](https://doc.rust-lang.org/std/marker/trait.Sized.html) about how `Sized` is implicitly bound.
* Refer to the syntax as `?Sized`, since it's currently the only allowed trait that can follow `?`.
This commit is contained in:
Manish Goregaokar 2016-05-21 09:08:10 +05:30
commit f262bb899c

View file

@ -47,7 +47,7 @@ pointers, can use this `impl`.
# ?Sized
If you want to write a function that accepts a dynamically sized type, you
can use the special bound, `?Sized`:
can use the special bound syntax, `?Sized`:
```rust
struct Foo<T: ?Sized> {
@ -55,6 +55,7 @@ struct Foo<T: ?Sized> {
}
```
This `?`, read as “T may be `Sized`”, means that this bound is special: it
lets us match more kinds, not less. Its almost like every `T` implicitly has
`T: Sized`, and the `?` undoes this default.
This `?Sized`, read as “T may or may not be `Sized`”, which allows us to match
both sized and unsized types. All generic type parameters implicitly
have the `Sized` bound, so the `?Sized` can be used to opt-out of the implicit
bound.