mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
add must_use on pointer equality functions
This commit is contained in:
parent
b0889cb4ed
commit
34ea540720
@ -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 ())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user