diff options
| author | Corey Farwell <coreyf@rwell.org> | 2016-11-25 13:21:49 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2016-12-18 14:55:14 -0800 |
| commit | 86fc63e62ddc0a271210b8cc7cc2a6de6874b8f8 (patch) | |
| tree | b4b2329077e4e537719a8f0556525c66d4d8f73c /src/libstd/thread/mod.rs | |
| parent | 1f965cc8e9dc8f8b26eac99cffdef6501cf0c617 (diff) | |
| download | rust-86fc63e62ddc0a271210b8cc7cc2a6de6874b8f8.tar.gz rust-86fc63e62ddc0a271210b8cc7cc2a6de6874b8f8.zip | |
Implement `fmt::Debug` for all structures in libstd.
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
Diffstat (limited to 'src/libstd/thread/mod.rs')
| -rw-r--r-- | src/libstd/thread/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 255cd2a9bc0..8cfa0200bf8 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -203,6 +203,7 @@ pub use self::local::{LocalKey, LocalKeyState}; /// Thread configuration. Provides detailed control over the properties /// and behavior of new threads. #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct Builder { // A name for the thread-to-be, for identification in panic messages name: Option<String>, @@ -573,6 +574,13 @@ impl ThreadId { } } +#[stable(feature = "std_debug", since = "1.15.0")] +impl fmt::Debug for ThreadId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("ThreadId { .. }") + } +} + //////////////////////////////////////////////////////////////////////////////// // Thread //////////////////////////////////////////////////////////////////////////////// @@ -788,6 +796,13 @@ impl<T> IntoInner<imp::Thread> for JoinHandle<T> { fn into_inner(self) -> imp::Thread { self.0.native.unwrap() } } +#[stable(feature = "std_debug", since = "1.15.0")] +impl<T> fmt::Debug for JoinHandle<T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("JoinHandle { .. }") + } +} + fn _assert_sync_and_send() { fn _assert_both<T: Send + Sync>() {} _assert_both::<JoinHandle<()>>(); |
