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/libcore | |
| 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/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index e75401f6ce0..1eebf67ad04 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -942,6 +942,13 @@ impl<'b, T: ?Sized> Ref<'b, T> { #[unstable(feature = "coerce_unsized", issue = "27732")] impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {} +#[stable(feature = "std_guard_impls", since = "1.20")] +impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.value.fmt(f) + } +} + impl<'b, T: ?Sized> RefMut<'b, T> { /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum /// variant. @@ -1034,6 +1041,13 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { #[unstable(feature = "coerce_unsized", issue = "27732")] impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {} +#[stable(feature = "std_guard_impls", since = "1.20")] +impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.value.fmt(f) + } +} + /// The core primitive for interior mutability in Rust. /// /// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the |
