Add #[rustc_on_unimplemented] annotations to more traits

This commit is contained in:
P1start 2015-01-21 11:04:17 +13:00
parent 5d2056a7e3
commit be138ed2bd
3 changed files with 9 additions and 0 deletions

View file

@ -243,6 +243,8 @@ pub trait Show {
/// Format trait for the `:?` format. Useful for debugging, most all types
/// should implement this.
#[unstable = "I/O and core have yet to be reconciled"]
#[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is defined in your \
crate, add `#[derive(Debug)]` or manually implement it"]
pub trait Debug {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;
@ -266,6 +268,8 @@ pub trait String {
/// When a value can be semantically expressed as a String, this trait may be
/// used. It corresponds to the default format, `{}`.
#[unstable = "I/O and core have yet to be reconciled"]
#[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default formatter; try using \
`:?` instead if you are using a format string"]
pub trait Display {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;

View file

@ -82,6 +82,8 @@ use uint;
/// else.
#[lang="iterator"]
#[stable]
#[rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling `.iter()` or a similar \
method"]
pub trait Iterator {
#[stable]
type Item;

View file

@ -30,6 +30,7 @@ use clone::Clone;
/// Types able to be transferred across task boundaries.
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
#[lang="send"]
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
pub unsafe trait Send: 'static {
// empty.
}
@ -37,6 +38,7 @@ pub unsafe trait Send: 'static {
/// Types with a constant size known at compile-time.
#[stable]
#[lang="sized"]
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
pub trait Sized {
// Empty.
}
@ -193,6 +195,7 @@ pub trait Copy {
/// `transmute`-ing from `&T` to `&mut T` is illegal).
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
#[lang="sync"]
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
pub unsafe trait Sync {
// Empty
}