From 34ea540720828538d858cf66cc8473bb2f54e713 Mon Sep 17 00:00:00 2001 From: asquared31415 <34665709+asquared31415@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:10:51 +0000 Subject: [PATCH] add must_use on pointer equality functions --- library/core/src/ptr/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index fe3d46d77f0da..5cd2a30331068 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(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(a: *const T, b: *const T) -> bool { a == b } @@ -1886,6 +1887,7 @@ pub fn eq(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(p: *const T, q: *const U) -> bool { (p as *const ()) == (q as *const ()) }