diff --git a/tests/ui/deref_addrof.fixed b/tests/ui/deref_addrof.fixed index aa1cf19b76f..db7c44c4c63 100644 --- a/tests/ui/deref_addrof.fixed +++ b/tests/ui/deref_addrof.fixed @@ -43,6 +43,10 @@ fn main() { let b = *aref; let _ = unsafe { *core::ptr::addr_of!(a) }; + + // do NOT lint for array as sematic differences with/out `*&`. + let _repeat = [0; 64]; + let _arr = [0, 1, 2, 3, 4]; } #[derive(Copy, Clone)] diff --git a/tests/ui/deref_addrof.rs b/tests/ui/deref_addrof.rs index 38796aef390..79b82a76a13 100644 --- a/tests/ui/deref_addrof.rs +++ b/tests/ui/deref_addrof.rs @@ -43,6 +43,10 @@ fn main() { let b = **&aref; let _ = unsafe { *core::ptr::addr_of!(a) }; + + // do NOT lint for array as sematic differences with/out `*&`. + let _repeat = *&[0; 64]; + let _arr = *&[0, 1, 2, 3, 4]; } #[derive(Copy, Clone)] diff --git a/tests/ui/deref_addrof.stderr b/tests/ui/deref_addrof.stderr index 5e3cb417aa0..856d775d932 100644 --- a/tests/ui/deref_addrof.stderr +++ b/tests/ui/deref_addrof.stderr @@ -50,7 +50,19 @@ LL | let b = **&aref; | ^^^^^^ help: try: `aref` error: immediately dereferencing a reference - --> tests/ui/deref_addrof.rs:53:17 + --> tests/ui/deref_addrof.rs:48:19 + | +LL | let _repeat = *&[0; 64]; + | ^^^^^^^^^ help: try: `[0; 64]` + +error: immediately dereferencing a reference + --> tests/ui/deref_addrof.rs:49:16 + | +LL | let _arr = *&[0, 1, 2, 3, 4]; + | ^^^^^^^^^^^^^^^^^ help: try: `[0, 1, 2, 3, 4]` + +error: immediately dereferencing a reference + --> tests/ui/deref_addrof.rs:57:17 | LL | inline!(*& $(@expr self)) | ^^^^^^^^^^^^^^^^ help: try: `$(@expr self)` @@ -58,12 +70,12 @@ LL | inline!(*& $(@expr self)) = note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: immediately dereferencing a reference - --> tests/ui/deref_addrof.rs:57:17 + --> tests/ui/deref_addrof.rs:61:17 | LL | inline!(*&mut $(@expr self)) | ^^^^^^^^^^^^^^^^^^^ help: try: `$(@expr self)` | = note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 10 previous errors +error: aborting due to 12 previous errors