diff options
| author | Postmodern <postmodern.mod3@gmail.com> | 2016-05-19 17:07:29 -0700 |
|---|---|---|
| committer | Postmodern <postmodern.mod3@gmail.com> | 2016-05-19 17:07:29 -0700 |
| commit | 2fd4e604a46d1175f260a33efdfcacb7b48ed1ff (patch) | |
| tree | 1a83e11cf6599307fc21923bec7110bea92830dc /src | |
| parent | 764ef92ae7a26cbb9c2121de3812a0a17739f65f (diff) | |
| download | rust-2fd4e604a46d1175f260a33efdfcacb7b48ed1ff.tar.gz rust-2fd4e604a46d1175f260a33efdfcacb7b48ed1ff.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/book/unsized-types.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md index 73b90355e4f..d94409a7b82 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 syntax, `?Sized`: ```rust struct Foo<T: ?Sized> { @@ -55,6 +55,5 @@ 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`”, allowing us to match both constant size and unsized types. +All generic type parameters implicitly have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound. |
