Skip to content

Commit b9673f4

Browse files
committed
Add diagnostic items for without_provenance and without_provenance_mut
Adds diagnostic items for `core::ptr::without_provenance` and `core::ptr::without_provenance_mut`. Will be used to enhance clippy lint `transmuting_null`, see rust-lang/rust-clippy#16336.
1 parent 5497a36 commit b9673f4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/ptr/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ pub const fn null_mut<T: PointeeSized + Thin>() -> *mut T {
880880
#[must_use]
881881
#[stable(feature = "strict_provenance", since = "1.84.0")]
882882
#[rustc_const_stable(feature = "strict_provenance", since = "1.84.0")]
883+
#[rustc_diagnostic_item = "ptr_without_provenance"]
883884
pub const fn without_provenance<T>(addr: usize) -> *const T {
884885
without_provenance_mut(addr)
885886
}
@@ -918,6 +919,7 @@ pub const fn dangling<T>() -> *const T {
918919
#[must_use]
919920
#[stable(feature = "strict_provenance", since = "1.84.0")]
920921
#[rustc_const_stable(feature = "strict_provenance", since = "1.84.0")]
922+
#[rustc_diagnostic_item = "ptr_without_provenance_mut"]
921923
#[allow(integer_to_ptr_transmutes)] // Expected semantics here.
922924
pub const fn without_provenance_mut<T>(addr: usize) -> *mut T {
923925
// An int-to-pointer transmute currently has exactly the intended semantics: it creates a

0 commit comments

Comments
 (0)