about summary refs log tree commit diff
path: root/library/core/src/cell.rs
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2022-05-20 11:16:30 -0700
committerJosh Stone <jistone@redhat.com>2022-05-20 11:16:30 -0700
commit83abb7c18f999617d08f8b715f0c7256b3f09e7c (patch)
tree4cdb0a8580b5e3f7fe47911e305ba89258262aa8 /library/core/src/cell.rs
parent22ee39504a702f75485582d02060495a01254de1 (diff)
downloadrust-83abb7c18f999617d08f8b715f0c7256b3f09e7c.tar.gz
rust-83abb7c18f999617d08f8b715f0c7256b3f09e7c.zip
Fix `Display` for `cell::{Ref,RefMut}`
These guards changed to pointers in #97027, but their `Display` was
formatting that field directly, which made it show the raw pointer
value. Now we go through `Deref` to display the real value again.
Diffstat (limited to 'library/core/src/cell.rs')
-rw-r--r--library/core/src/cell.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index 5448ced803a..9884b7f404e 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -1487,7 +1487,7 @@ impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b,
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
 impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.value.fmt(f)
+        (**self).fmt(f)
     }
 }
 
@@ -1735,7 +1735,7 @@ impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefM
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
 impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.value.fmt(f)
+        (**self).fmt(f)
     }
 }