add must_use on pointer equality functions
This commit is contained in:
parent
b0889cb4ed
commit
34ea540720
@ -1864,6 +1864,7 @@ pub unsafe fn write_volatile<T>(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<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 ())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user