rust/tests/ui/ptr_eq_no_std.stderr
Samuel Tardieu d7d0abd2ad Lint more cases of ptr::eq()
Also, do not strip conversions of a function pointer to a `*const`, as
no implicit conversion will take place.
2025-03-02 15:50:13 +01:00

41 lines
1.7 KiB
Text

error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:31:13
|
LL | let _ = a as *const _ as usize == b as *const _ as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a, b)`
|
= note: `-D clippy::ptr-eq` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`
error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:33:13
|
LL | let _ = a as *const _ == b as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a, b)`
error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:35:13
|
LL | let _ = a.as_ptr() == b as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a.as_ptr(), b as *const _)`
error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:37:13
|
LL | let _ = a.as_ptr() == b.as_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a.as_ptr(), b.as_ptr())`
error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:48:13
|
LL | let _ = a.as_mut_ptr() == b as *mut [i32] as *mut _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a.as_mut_ptr(), b as *mut [i32] as *mut _)`
error: use `core::ptr::eq` when comparing raw pointers
--> tests/ui/ptr_eq_no_std.rs:50:13
|
LL | let _ = a.as_mut_ptr() == b.as_mut_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(a.as_mut_ptr(), b.as_mut_ptr())`
error: aborting due to 6 previous errors