about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-12-19 14:41:34 +0530
committerGitHub <noreply@github.com>2022-12-19 14:41:34 +0530
commitf74bcfbdb1fa2b2c3904f2f24f0c8ddb3c00b5c6 (patch)
treedbc17630a5498f6c2c4102cd60ba45a8d404d3bf
parent224fa3907e319405fdabdb06c33f99b896754773 (diff)
parentf2d03667914528a672c476b3718b0a0ead0736da (diff)
downloadrust-f74bcfbdb1fa2b2c3904f2f24f0c8ddb3c00b5c6.tar.gz
rust-f74bcfbdb1fa2b2c3904f2f24f0c8ddb3c00b5c6.zip
Rollup merge of #105682 - thomcc:expose-ptr-fmt, r=RalfJung
Use `expose_addr()` in `fmt::Pointer`

Discussion in https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Should.20.60fmt.3A.3APointer.60.20expose.20the.20argument.3F on whether or not we should do this (still undecided).

CC `@RalfJung`
-rw-r--r--library/core/src/fmt/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 122da675f7e..5f4a666de92 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -2471,8 +2471,8 @@ impl Display for char {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for *const T {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
-        // Cast is needed here because `.addr()` requires `T: Sized`.
-        pointer_fmt_inner((*self as *const ()).addr(), f)
+        // Cast is needed here because `.expose_addr()` requires `T: Sized`.
+        pointer_fmt_inner((*self as *const ()).expose_addr(), f)
     }
 }