Skip to content

Commit 6a9ee09

Browse files
committed
Rollup merge of #21445 - P1start:no-implemented, r=nikomatsakis
2 parents d19f28b + 87db16c commit 6a9ee09

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/libcore/fmt/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ pub trait Show {
243243
/// Format trait for the `:?` format. Useful for debugging, most all types
244244
/// should implement this.
245245
#[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"]
246248
pub trait Debug {
247249
/// Formats the value using the given formatter.
248250
fn fmt(&self, &mut Formatter) -> Result;
@@ -266,6 +268,8 @@ pub trait String {
266268
/// When a value can be semantically expressed as a String, this trait may be
267269
/// used. It corresponds to the default format, `{}`.
268270
#[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"]
269273
pub trait Display {
270274
/// Formats the value using the given formatter.
271275
fn fmt(&self, &mut Formatter) -> Result;

src/libcore/iter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ use usize;
8282
/// else.
8383
#[lang="iterator"]
8484
#[stable]
85+
#[rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling `.iter()` or a similar \
86+
method"]
8587
pub trait Iterator {
8688
#[stable]
8789
type Item;

src/libcore/marker.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@
2727

2828
use clone::Clone;
2929

30-
/// Types able to be transferred across task boundaries.
30+
/// Types able to be transferred across thread boundaries.
3131
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
3232
#[lang="send"]
33+
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
3334
pub unsafe trait Send: 'static {
3435
// empty.
3536
}
3637

3738
/// Types with a constant size known at compile-time.
3839
#[stable]
3940
#[lang="sized"]
41+
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
4042
pub trait Sized {
4143
// Empty.
4244
}
@@ -146,11 +148,11 @@ pub trait Copy {
146148
// Empty.
147149
}
148150

149-
/// Types that can be safely shared between tasks when aliased.
151+
/// Types that can be safely shared between threads when aliased.
150152
///
151153
/// The precise definition is: a type `T` is `Sync` if `&T` is
152154
/// 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.
154156
///
155157
/// As one would expect, primitive types like `u8` and `f64` are all
156158
/// `Sync`, and so are simple aggregate types containing them (like
@@ -193,6 +195,7 @@ pub trait Copy {
193195
/// `transmute`-ing from `&T` to `&mut T` is illegal).
194196
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
195197
#[lang="sync"]
198+
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
196199
pub unsafe trait Sync {
197200
// Empty
198201
}

0 commit comments

Comments
 (0)