Skip to content

Commit 04b9c25

Browse files
authored
Rollup merge of rust-lang#46121 - malbarbo:rc_arc_pointer, r=dtolnay
Print the address of the pointed value in Pointer impl for Rc and Arc Fixes rust-lang#35384
2 parents b32d9ad + cbcaf73 commit 04b9c25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/liballoc/arc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
13281328
#[stable(feature = "rust1", since = "1.0.0")]
13291329
impl<T: ?Sized> fmt::Pointer for Arc<T> {
13301330
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1331-
fmt::Pointer::fmt(&self.ptr, f)
1331+
fmt::Pointer::fmt(&(&**self as *const T), f)
13321332
}
13331333
}
13341334

src/liballoc/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> {
10721072
#[stable(feature = "rust1", since = "1.0.0")]
10731073
impl<T: ?Sized> fmt::Pointer for Rc<T> {
10741074
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1075-
fmt::Pointer::fmt(&self.ptr, f)
1075+
fmt::Pointer::fmt(&(&**self as *const T), f)
10761076
}
10771077
}
10781078

0 commit comments

Comments
 (0)