2020-01-19 20:16:50 -06:00
|
|
|
error: transmute from a pointer type (`*const T`) to a reference type (`&T`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:5:17
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
LL | let _: &T = std::mem::transmute(p);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ref)]`
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:8:21
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:11:17
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
LL | let _: &T = std::mem::transmute(m);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:14:21
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:17:17
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:20:21
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:23:17
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
LL | let _: &T = std::mem::transmute(om);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`
|
|
|
|
|
2022-09-22 12:39:38 -05:00
|
|
|
error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, u8>`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:33:32
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
LL | let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
|
2022-06-30 03:50:09 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<_>>()`
|
2020-01-19 20:16:50 -06:00
|
|
|
|
2022-09-22 12:39:38 -05:00
|
|
|
error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, &u8>`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:35:33
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
|
LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
|
2022-06-30 03:50:09 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<&_>>()`
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:39:14
|
2020-01-19 20:16:50 -06:00
|
|
|
|
|
2023-07-02 07:35:19 -05:00
|
|
|
LL | unsafe { std::mem::transmute::<_, Bar>(raw) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)`
|
2020-01-19 20:16:50 -06:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:44:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | 0 => std::mem::transmute(x),
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:45:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | 1 => std::mem::transmute(y),
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:46:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:47:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:55:19
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | let _: &u32 = std::mem::transmute(a);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:56:19
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:58:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | 0 => std::mem::transmute(x),
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:59:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:67:19
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | let _: &u32 = std::mem::transmute(a);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`
|
|
|
|
|
|
|
|
error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:68:19
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:70:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
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`)
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/transmute_ptr_to_ref.rs:71:14
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | _ => std::mem::transmute::<_, &&'b u32>(x),
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)`
|
|
|
|
|
|
|
|
error: aborting due to 22 previous errors
|
2020-01-19 20:16:50 -06:00
|
|
|
|