about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-02-15 14:36:48 +0800
committerkennytm <kennytm@gmail.com>2018-02-15 14:36:48 +0800
commit03b089d2208167d113cb7bb81f2de48b78785658 (patch)
treeab2e38fb82c8a5fc5db186d93946c4787d2dff78 /src/libcore
parentce89c3de760a402fcffb63c6914e4d8314a69250 (diff)
parent38064a9a7ce6b5050ca1d629aef22f17f2548d07 (diff)
downloadrust-03b089d2208167d113cb7bb81f2de48b78785658.tar.gz
rust-03b089d2208167d113cb7bb81f2de48b78785658.zip
Rollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs, r=QuietMisdreavus
Clarified why `Sized` bound not implicit on trait's implicit `Self` type.

This part of the documentation was a little confusing to me on first read. I've added a couple lines for further explanation. Hopefully this makes things a bit clearer for new readers.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/marker.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 3032fb2de33..98e0f71eb93 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -63,9 +63,13 @@ impl<T: ?Sized> !Send for *mut T { }
 /// struct BarUse(Bar<[i32]>); // OK
 /// ```
 ///
-/// The one exception is the implicit `Self` type of a trait, which does not
-/// get an implicit `Sized` bound. This is because a `Sized` bound prevents
-/// the trait from being used to form a [trait object]:
+/// The one exception is the implicit `Self` type of a trait. A trait does not
+/// have an implicit `Sized` bound as this is incompatible with [trait object]s
+/// where, by definition, the trait needs to work with all possible implementors,
+/// and thus could be any size.
+///
+/// Although Rust will let you bind `Sized` to a trait, you won't
+/// be able to use it to form a trait object later:
 ///
 /// ```
 /// # #![allow(unused_variables)]