From 288c0c3081419c0d522d76cfbb36fabd038ed4f2 Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Wed, 14 Feb 2018 11:30:53 +0000 Subject: [PATCH 1/2] Clarified why `Sized` bound not implicit on trait's implicit `Self` type. --- src/libcore/marker.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 3032fb2de33ad..5b482d467bc8d 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -63,9 +63,13 @@ impl !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)] From 38064a9a7ce6b5050ca1d629aef22f17f2548d07 Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Wed, 14 Feb 2018 19:14:25 +0000 Subject: [PATCH 2/2] Review change - Expanded on explanation. --- src/libcore/marker.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 5b482d467bc8d..98e0f71eb9356 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -65,11 +65,11 @@ impl !Send for *mut T { } /// /// 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. +/// 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 as a trait object later: +/// be able to use it to form a trait object later: /// /// ``` /// # #![allow(unused_variables)]