File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
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 usize;
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 27
27
28
28
use clone:: Clone ;
29
29
30
- /// Types able to be transferred across task boundaries.
30
+ /// Types able to be transferred across thread 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
}
@@ -146,11 +148,11 @@ pub trait Copy {
146
148
// Empty.
147
149
}
148
150
149
- /// Types that can be safely shared between tasks when aliased.
151
+ /// Types that can be safely shared between threads when aliased.
150
152
///
151
153
/// The precise definition is: a type `T` is `Sync` if `&T` is
152
154
/// thread-safe. In other words, there is no possibility of data races
153
- /// when passing `&T` references between tasks .
155
+ /// when passing `&T` references between threads .
154
156
///
155
157
/// As one would expect, primitive types like `u8` and `f64` are all
156
158
/// `Sync`, and so are simple aggregate types containing them (like
@@ -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