about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2015-10-18 04:17:33 -0700
committerStefan O'Rear <stefanor@cox.net>2015-10-18 12:29:06 -0700
commitdc61d0f0938f500dd3558b3989a24ad3bc7e20a8 (patch)
tree0e10245bf2bec22a08d082f4d5287f399b62bf24
parent206af38e74ce7fa4b0e781ece7f1067c018c580e (diff)
Document DST parameters on std::marker::Sized
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"]