about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-30 18:25:34 +0200
committerGitHub <noreply@github.com>2024-06-30 18:25:34 +0200
commit7a43417c36b35ff91dc826654435f3c6e5d31595 (patch)
tree28d7fd15bc25a2213f30ddb1a71f209326d003a2
parent7e05bc3854ae91a6b754bf8d8755984425e2b776 (diff)
parent35f209361fcd0751b3d260d67962b0af2d455596 (diff)
downloadrust-7a43417c36b35ff91dc826654435f3c6e5d31595.tar.gz
rust-7a43417c36b35ff91dc826654435f3c6e5d31595.zip
Rollup merge of #127069 - Sky9x:fmt-pointer-use-addr, r=Nilstrieb
small correction to fmt::Pointer impl

~~The `addr` method does not require `T: Sized`, and is preferred for use over `expose_provenance`.~~
`expose_provenance` does not require `T: Sized`.
-rw-r--r--library/core/src/fmt/mod.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 3bcd4be1834..d0e188dfcd1 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -2484,8 +2484,7 @@ 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 `.expose_provenance()` requires `T: Sized`.
-        pointer_fmt_inner((*self as *const ()).expose_provenance(), f)
+        pointer_fmt_inner(self.expose_provenance(), f)
     }
 }