diff options
| author | Urgau <urgau@numericable.fr> | 2023-08-22 15:41:07 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2023-08-22 15:47:29 +0200 |
| commit | 7ee77b5d1b91adf4c683d0d871015fe68ebca9ea (patch) | |
| tree | 2ecc51a3018c338eece2a707e6a79b6b199176e3 /library/core/src/ptr | |
| parent | b4d09f3b811cf9bb73288c054557f2c2436bb37d (diff) | |
| download | rust-7ee77b5d1b91adf4c683d0d871015fe68ebca9ea.tar.gz rust-7ee77b5d1b91adf4c683d0d871015fe68ebca9ea.zip | |
Add support for ptr::write for the invalid_reference_casting lint
Diffstat (limited to 'library/core/src/ptr')
| -rw-r--r-- | library/core/src/ptr/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 5f094ac4e7e..01e36044899 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1357,6 +1357,7 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T { #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")] +#[rustc_diagnostic_item = "ptr_write"] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn write<T>(dst: *mut T, src: T) { // Semantically, it would be fine for this to be implemented as a @@ -1459,6 +1460,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) { #[inline] #[stable(feature = "ptr_unaligned", since = "1.17.0")] #[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")] +#[rustc_diagnostic_item = "ptr_write_unaligned"] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) { // SAFETY: the caller must guarantee that `dst` is valid for writes. @@ -1607,6 +1609,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T { /// ``` #[inline] #[stable(feature = "volatile", since = "1.9.0")] +#[rustc_diagnostic_item = "ptr_write_volatile"] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub unsafe fn write_volatile<T>(dst: *mut T, src: T) { // SAFETY: the caller must uphold the safety contract for `volatile_store`. |
