about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-10-20 06:36:50 +0000
committerbors <bors@rust-lang.org>2015-10-20 06:36:50 +0000
commit2e86485f7b9cc7f4dd702b4cd1c767e12d6d91eb (patch)
tree077461256587d2fbc6038509f4aa95763c9f3dec
parent7275d3d361acd9b0dbdfca8d6a3aa39da3d2071d (diff)
parentdc61d0f0938f500dd3558b3989a24ad3bc7e20a8 (diff)
Auto merge of #29140 - sorear:dst-document-on-sized, r=alexcrichton
This is for discoverability.  If someone wants to know what `?Sized` means, then
Sized will be the only keyword they can use to search; so even though this is
technically a language matter, it makes sense to document it where it will be
looked for.
-rw-r--r--src/libcore/marker.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index f9480b4349d..27d8af2e8a8 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -36,6 +36,17 @@ impl<T> !Send for *const T { }
 impl<T> !Send for *mut T { }
 
 /// Types with a constant size known at compile-time.
+///
+/// All type parameters which can be bounded have an implicit bound of `Sized`. The special syntax
+/// `?Sized` can be used to remove this bound if it is not appropriate.
+///
+/// ```
+/// struct Foo<T>(T);
+/// struct Bar<T: ?Sized>(T);
+///
+/// // struct FooUse(Foo<[i32]>); // error: Sized is not implemented for [i32]
+/// struct BarUse(Bar<[i32]>); // OK
+/// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[lang = "sized"]
 #[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]