File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,8 @@ pub trait Show {
243
243
/// Format trait for the `:?` format. Useful for debugging, most all types
244
244
/// should implement this.
245
245
#[ unstable = "I/O and core have yet to be reconciled" ]
246
+ #[ rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is defined in your \
247
+ crate, add `#[derive(Debug)]` or manually implement it"]
246
248
pub trait Debug {
247
249
/// Formats the value using the given formatter.
248
250
fn fmt ( & self , & mut Formatter ) -> Result ;
@@ -266,6 +268,8 @@ pub trait String {
266
268
/// When a value can be semantically expressed as a String, this trait may be
267
269
/// used. It corresponds to the default format, `{}`.
268
270
#[ unstable = "I/O and core have yet to be reconciled" ]
271
+ #[ rustc_on_unimplemented = "`{Self}` cannot be formatted with the default formatter; try using \
272
+ `:?` instead if you are using a format string"]
269
273
pub trait Display {
270
274
/// Formats the value using the given formatter.
271
275
fn fmt ( & self , & mut Formatter ) -> Result ;
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ use uint;
82
82
/// else.
83
83
#[ lang="iterator" ]
84
84
#[ stable]
85
+ #[ rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling `.iter()` or a similar \
86
+ method"]
85
87
pub trait Iterator {
86
88
#[ stable]
87
89
type Item ;
Original file line number Diff line number Diff line change @@ -30,13 +30,15 @@ use clone::Clone;
30
30
/// Types able to be transferred across task boundaries.
31
31
#[ unstable = "will be overhauled with new lifetime rules; see RFC 458" ]
32
32
#[ lang="send" ]
33
+ #[ rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely" ]
33
34
pub unsafe trait Send : ' static {
34
35
// empty.
35
36
}
36
37
37
38
/// Types with a constant size known at compile-time.
38
39
#[ stable]
39
40
#[ lang="sized" ]
41
+ #[ rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time" ]
40
42
pub trait Sized {
41
43
// Empty.
42
44
}
@@ -193,6 +195,7 @@ pub trait Copy {
193
195
/// `transmute`-ing from `&T` to `&mut T` is illegal).
194
196
#[ unstable = "will be overhauled with new lifetime rules; see RFC 458" ]
195
197
#[ lang="sync" ]
198
+ #[ rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely" ]
196
199
pub unsafe trait Sync {
197
200
// Empty
198
201
}
You can’t perform that action at this time.
0 commit comments