Skip to content

Commit

Permalink
Clarified why Sized bound not implicit on trait's implicit Self t…
Browse files Browse the repository at this point in the history
…ype.
  • Loading branch information
jacob-hughes committed Feb 14, 2018
1 parent 4d2d3fc commit 288c0c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/libcore/marker.rs
Expand Up @@ -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)]
Expand Down

0 comments on commit 288c0c3

Please sign in to comment.