Skip to content

Commit

Permalink
Rollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs…
Browse files Browse the repository at this point in the history
…, 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.
  • Loading branch information
kennytm committed Feb 15, 2018
2 parents ce89c3d + 38064a9 commit 03b089d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
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, 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)]
Expand Down

0 comments on commit 03b089d

Please sign in to comment.