Skip to content

Commit 2fd4e60

Browse files
committed
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.
1 parent 764ef92 commit 2fd4e60

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/doc/book/unsized-types.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ pointers, can use this `impl`.
4747
# ?Sized
4848

4949
If you want to write a function that accepts a dynamically sized type, you
50-
can use the special bound, `?Sized`:
50+
can use the special syntax, `?Sized`:
5151

5252
```rust
5353
struct Foo<T: ?Sized> {
5454
f: T,
5555
}
5656
```
5757

58-
This `?`, read as “T may be `Sized`”, means that this bound is special: it
59-
lets us match more kinds, not less. It’s almost like every `T` implicitly has
60-
`T: Sized`, and the `?` undoes this default.
58+
This `?Sized`, read as “T may or may not be `Sized`”, allowing us to match both constant size and unsized types.
59+
All generic type parameters implicitly have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound.

0 commit comments

Comments
 (0)