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`.
This commit is contained in:
Matthias Krüger 2024-06-30 18:25:34 +02:00 committed by GitHub
commit 7a43417c36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}
}