about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-21 09:08:10 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-21 09:08:10 +0530
commitf262bb899ce4d028d75f9f272db2313dea3cf244 (patch)
treef5b856d860ab7ccf6c5db188b76066bfe78674f6
parentc57bb106d85d52b5c24634bcc68a4637c94c2472 (diff)
parent71af58accf8f773a7d410cf947940487f65ae70f (diff)
downloadrust-f262bb899ce4d028d75f9f272db2313dea3cf244.tar.gz
rust-f262bb899ce4d028d75f9f272db2313dea3cf244.zip
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 `?`.
-rw-r--r--src/doc/book/unsized-types.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md
index 73b90355e4f..a23470d39fa 100644
--- a/src/doc/book/unsized-types.md
+++ b/src/doc/book/unsized-types.md
@@ -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. It’s 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.