Skip to content

Commit f262bb8

Browse files
committed
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 `?`.
2 parents c57bb10 + 71af58a commit f262bb8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/doc/book/unsized-types.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ 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 bound 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`”, which allows us to match
59+
both sized and unsized types. All generic type parameters implicitly
60+
have the `Sized` bound, so the `?Sized` can be used to opt-out of the implicit
61+
bound.

0 commit comments

Comments
 (0)