diff options
| author | Jacob Hughes <jacob.hughes@kcl.ac.uk> | 2018-02-14 11:30:53 +0000 |
|---|---|---|
| committer | Jacob Hughes <jacob.hughes@kcl.ac.uk> | 2018-02-14 15:50:26 +0000 |
| commit | 288c0c3081419c0d522d76cfbb36fabd038ed4f2 (patch) | |
| tree | ffe0e54ca15507943b21006e975fd33324de0e1a /src/libcore | |
| parent | 4d2d3fc5dadf894a8ad709a5860a549f2c0b1032 (diff) | |
| download | rust-288c0c3081419c0d522d76cfbb36fabd038ed4f2.tar.gz rust-288c0c3081419c0d522d76cfbb36fabd038ed4f2.zip | |
Clarified why `Sized` bound not implicit on trait's implicit `Self` type.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/marker.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 3032fb2de33..5b482d467bc 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, 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)] |
