diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-06-23 06:02:11 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-23 06:02:11 -0600 |
| commit | bb2db942eeb47854aa1183d57c39ef2f33b89db0 (patch) | |
| tree | 0cce442ad69be64e7e27b577cd808dc220d254be /src/libstd | |
| parent | f3aebb0a838c2b42b9580e85f326e7bc9bbb4b33 (diff) | |
| parent | 14df54989aecb437e9cf6f3e066553cfbc979e26 (diff) | |
| download | rust-bb2db942eeb47854aa1183d57c39ef2f33b89db0.tar.gz rust-bb2db942eeb47854aa1183d57c39ef2f33b89db0.zip | |
Rollup merge of #42822 - ChrisMacNaughton:guard-traits, r=alexcrichton
Ensure Guard types impl Display & Debug Fixes #24372
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sync/mutex.rs | 7 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 9a242a96d46..fc6c7de9ef0 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -440,6 +440,13 @@ impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'a, T> { } } +#[stable(feature = "std_guard_impls", since = "1.20")] +impl<'a, T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + (**self).fmt(f) + } +} + pub fn guard_lock<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a sys::Mutex { &guard.__lock.inner } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 95bc8d30932..944801e8a3b 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -370,6 +370,13 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> { } } +#[stable(feature = "std_guard_impls", since = "1.20")] +impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + (**self).fmt(f) + } +} + #[stable(feature = "std_debug", since = "1.16.0")] impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -379,6 +386,13 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> { } } +#[stable(feature = "std_guard_impls", since = "1.20")] +impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + (**self).fmt(f) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T> { type Target = T; |
