about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-11-21 03:14:46 +0800
committerGitHub <noreply@github.com>2017-11-21 03:14:46 +0800
commit04b9c250025c4a310347d3384634d924f04f468c (patch)
tree3259a00896ac8ac6a4455f8fddb8f36fb3d6223e /src/liballoc
parentb32d9ada432d55ab6af2914d93064b6a42cbb39b (diff)
parentcbcaf736f820f33f619d3c9fe3d997e9e69d779e (diff)
downloadrust-04b9c250025c4a310347d3384634d924f04f468c.tar.gz
rust-04b9c250025c4a310347d3384634d924f04f468c.zip
Rollup merge of #46121 - malbarbo:rc_arc_pointer, r=dtolnay
Print the address of the pointed value in Pointer impl for Rc and Arc

Fixes https://github.com/rust-lang/rust/issues/35384
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs2
-rw-r--r--src/liballoc/rc.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 9481cd4e1a4..fc0a3c0fd88 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -1328,7 +1328,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> fmt::Pointer for Arc<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Pointer::fmt(&self.ptr, f)
+        fmt::Pointer::fmt(&(&**self as *const T), f)
     }
 }
 
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 2f8620cc750..72b9fa0eb47 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -1072,7 +1072,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> fmt::Pointer for Rc<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Pointer::fmt(&self.ptr, f)
+        fmt::Pointer::fmt(&(&**self as *const T), f)
     }
 }