From 6933848fbff3da5bfcd78ab836cda15e3f649ffc Mon Sep 17 00:00:00 2001 From: Urgau Date: Mon, 14 Aug 2023 11:47:42 +0200 Subject: [PATCH] Add diagnostic items for `<*const _>::cast` and `<*mut _>::cast_const` --- compiler/rustc_span/src/symbol.rs | 2 ++ library/core/src/ptr/const_ptr.rs | 1 + library/core/src/ptr/mut_ptr.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 745a3590720..f66b1e8970b 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -543,6 +543,7 @@ symbols! { const_panic_fmt, const_param_ty, const_precise_live_drops, + const_ptr_cast, const_raw_ptr_deref, const_raw_ptr_to_usize_cast, const_refs_to_cell, @@ -1159,6 +1160,7 @@ symbols! { profiler_runtime, ptr, ptr_cast, + ptr_cast_const, ptr_cast_mut, ptr_const_is_null, ptr_from_mut, diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 502f8a75863..ee69d89a4b7 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -55,6 +55,7 @@ impl *const T { /// Casts to a pointer of another type. #[stable(feature = "ptr_cast", since = "1.38.0")] #[rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0")] + #[rustc_diagnostic_item = "const_ptr_cast"] #[inline(always)] pub const fn cast(self) -> *const U { self as _ diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index d129e1d645f..9dbb3f9d322 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -112,6 +112,7 @@ impl *mut T { /// [`cast_mut`]: #method.cast_mut #[stable(feature = "ptr_const_cast", since = "1.65.0")] #[rustc_const_stable(feature = "ptr_const_cast", since = "1.65.0")] + #[rustc_diagnostic_item = "ptr_cast_const"] #[inline(always)] pub const fn cast_const(self) -> *const T { self as _