diff options
| author | asquared31415 <34665709+asquared31415@users.noreply.github.com> | 2023-10-02 15:10:51 +0000 |
|---|---|---|
| committer | asquared31415 <34665709+asquared31415@users.noreply.github.com> | 2023-10-02 15:10:51 +0000 |
| commit | 34ea540720828538d858cf66cc8473bb2f54e713 (patch) | |
| tree | d4fe2f49101268a52991607dabed74c9c3abc002 | |
| parent | b0889cb4ed0e6f3ed9f440180678872b02e7052c (diff) | |
| download | rust-34ea540720828538d858cf66cc8473bb2f54e713.tar.gz rust-34ea540720828538d858cf66cc8473bb2f54e713.zip | |
add must_use on pointer equality functions
| -rw-r--r-- | library/core/src/ptr/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index fe3d46d77f0..5cd2a303310 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1864,6 +1864,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz /// ``` #[stable(feature = "ptr_eq", since = "1.17.0")] #[inline(always)] +#[must_use = "pointer comparison produces a value"] pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool { a == b } @@ -1886,6 +1887,7 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool { /// ``` #[unstable(feature = "ptr_addr_eq", issue = "116324")] #[inline(always)] +#[must_use = "pointer comparison produces a value"] pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool { (p as *const ()) == (q as *const ()) } |
