| error: transmute from a pointer type (`*const T`) to a reference type (`&T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:10:21 |
| | |
| LL | let _: &T = std::mem::transmute(p); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` |
| | |
| = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings` |
| = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ref)]` |
| |
| error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:14:25 |
| | |
| LL | let _: &mut T = std::mem::transmute(m); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m` |
| |
| error: transmute from a pointer type (`*mut T`) to a reference type (`&T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:18:21 |
| | |
| LL | let _: &T = std::mem::transmute(m); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m` |
| |
| error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:22:25 |
| | |
| LL | let _: &mut T = std::mem::transmute(p as *mut T); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)` |
| |
| error: transmute from a pointer type (`*const U`) to a reference type (`&T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:26:21 |
| | |
| LL | let _: &T = std::mem::transmute(o); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)` |
| |
| error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:30:25 |
| | |
| LL | let _: &mut T = std::mem::transmute(om); |
| | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)` |
| |
| error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) |
| --> tests/ui/transmute_ptr_to_ref.rs:34:21 |
| | |
| LL | let _: &T = std::mem::transmute(om); |
| | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` |
| |
| error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) |
| --> tests/ui/transmute_ptr_to_ref.rs:46:32 |
| | |
| LL | let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<_>>()` |
| |
| error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) |
| --> tests/ui/transmute_ptr_to_ref.rs:49:33 |
| | |
| LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<&_>>()` |
| |
| error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) |
| --> tests/ui/transmute_ptr_to_ref.rs:54:14 |
| | |
| LL | unsafe { std::mem::transmute::<_, Bar>(raw) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&i32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:82:23 |
| | |
| LL | let _: &i32 = std::mem::transmute(w); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(w.0 as *const i32)` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:84:23 |
| | |
| LL | let _: &u32 = std::mem::transmute(w); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*w.0` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:86:24 |
| | |
| LL | let _: &&u32 = core::mem::transmute(x); |
| | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.ptr.cast::<&u32>()` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:91:17 |
| | |
| LL | let _ = std::mem::transmute::<_, &u32>(w); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*w.0.cast::<u32>()` |
| |
| error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:93:26 |
| | |
| LL | let _: &[&str] = core::mem::transmute(v); |
| | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(v.0 as *const [&str])` |
| |
| error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:95:17 |
| | |
| LL | let _ = std::mem::transmute::<_, &[i32]>(u); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u.0 as *const [i32])` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:97:24 |
| | |
| LL | let _: &&u32 = std::mem::transmute(y); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.0.cast::<&u32>()` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:99:23 |
| | |
| LL | let _: &u32 = std::mem::transmute(w + w); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(w + w).0` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:107:18 |
| | |
| LL | 0 => std::mem::transmute(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:109:18 |
| | |
| LL | 1 => std::mem::transmute(y), |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:111:18 |
| | |
| LL | 2 => std::mem::transmute::<_, &&'b u32>(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:113:18 |
| | |
| LL | _ => std::mem::transmute::<_, &&'b u32>(y), |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&'b u32>()` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:124:23 |
| | |
| LL | let _: &u32 = std::mem::transmute(a); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:126:23 |
| | |
| LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a.cast::<u32>()` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:129:18 |
| | |
| LL | 0 => std::mem::transmute(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:131:18 |
| | |
| LL | _ => std::mem::transmute::<_, &&'b u32>(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:142:23 |
| | |
| LL | let _: &u32 = std::mem::transmute(a); |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:144:23 |
| | |
| LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const u32)` |
| |
| error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:146:17 |
| | |
| LL | let _ = std::mem::transmute::<_, &u32>(Ptr(a)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(Ptr(a).0 as *const u32)` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:149:18 |
| | |
| LL | 0 => std::mem::transmute(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &u32)` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:151:18 |
| | |
| LL | 1 => std::mem::transmute::<_, &&'b u32>(x), |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:153:18 |
| | |
| LL | 2 => std::mem::transmute(y), |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(y.0 as *const () as *const &u32)` |
| |
| error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) |
| --> tests/ui/transmute_ptr_to_ref.rs:155:18 |
| | |
| LL | _ => std::mem::transmute::<_, &&'b u32>(y), |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(y.0 as *const () as *const &'b u32)` |
| |
| error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[u32]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:165:17 |
| | |
| LL | let _ = core::mem::transmute::<_, &[u32]>(ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [u32])` |
| |
| error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[u32]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:167:25 |
| | |
| LL | let _: &[u32] = core::mem::transmute(ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [u32])` |
| |
| error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&[u8]]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:171:17 |
| | |
| LL | let _ = core::mem::transmute::<_, &[&[u8]]>(a_s_ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&[u8]])` |
| |
| error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&[u8]]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:173:27 |
| | |
| LL | let _: &[&[u8]] = core::mem::transmute(a_s_ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&[u8]])` |
| |
| error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:177:17 |
| | |
| LL | let _ = core::mem::transmute::<_, &[i32]>(ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [i32])` |
| |
| error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:179:25 |
| | |
| LL | let _: &[i32] = core::mem::transmute(ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*ptr` |
| |
| error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:183:17 |
| | |
| LL | let _ = core::mem::transmute::<_, &[&str]>(a_s_ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&str])` |
| |
| error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) |
| --> tests/ui/transmute_ptr_to_ref.rs:185:26 |
| | |
| LL | let _: &[&str] = core::mem::transmute(a_s_ptr); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&str])` |
| |
| error: aborting due to 41 previous errors |
| |