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 unsafe fn write_volatile(dst: *mut T, src: T) { /// ``` #[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 ()) }