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 ()) }