]> git.lizzy.rs Git - rust.git/commitdiff
Clarified why `Sized` bound not implicit on trait's implicit `Self` type.
authorJacob Hughes <jacob.hughes@kcl.ac.uk>
Wed, 14 Feb 2018 11:30:53 +0000 (11:30 +0000)
committerJacob Hughes <jacob.hughes@kcl.ac.uk>
Wed, 14 Feb 2018 15:50:26 +0000 (15:50 +0000)
src/libcore/marker.rs

index 3032fb2de33ada892163d31d5ebcb3ddc64998c3..5b482d467bc8d45c45051e877608e1e65c846047 100644 (file)
@@ -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, one cannot know the size of all possible
+/// implementations of the trait.
+///
+/// Although Rust will let you bind `Sized` to a trait, you won't
+/// be able to use it as a trait object later:
 ///
 /// ```
 /// # #![allow(unused_variables)]