|
1 | 1 | error: transmute from an integer to a pointer
|
2 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:20:9 |
| 2 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:19:39 |
3 | 3 | |
|
4 |
| -LL | transmute::<usize, *const i32>(usize::MAX) |
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32` |
| 4 | +LL | let _ptr_i32_transmute = unsafe { transmute::<usize, *const i32>(usize::MAX) }; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32` |
6 | 6 | |
|
7 | 7 | = note: `-D clippy::useless-transmute` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: transmute from a pointer to a pointer
|
10 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:26:9 |
| 10 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:23:38 |
11 | 11 | |
|
12 |
| -LL | transmute::<*const i32, *const i8>(ptr_i32) |
13 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as *const i8` |
| 12 | +LL | let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) }; |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as *const i8` |
14 | 14 | |
|
15 | 15 | = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
|
16 | 16 |
|
17 | 17 | error: transmute from a pointer to a pointer
|
18 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:34:9 |
| 18 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:29:46 |
19 | 19 | |
|
20 |
| -LL | transmute::<*const [i32], *const [u16]>(slice_ptr) |
21 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice_ptr as *const [u16]` |
| 20 | +LL | let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u16]>(slice_ptr) }; |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice_ptr as *const [u16]` |
22 | 22 |
|
23 | 23 | error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead
|
24 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:42:9 |
| 24 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:35:50 |
25 | 25 | |
|
26 |
| -LL | transmute::<*const i32, usize>(ptr_i32) |
27 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize` |
| 26 | +LL | let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) }; |
| 27 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize` |
28 | 28 | |
|
29 | 29 | = note: `-D clippy::transmutes-expressible-as-ptr-casts` implied by `-D warnings`
|
30 | 30 |
|
31 | 31 | error: transmute from a reference to a pointer
|
32 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:50:9 |
| 32 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:41:41 |
33 | 33 | |
|
34 |
| -LL | transmute::<&[i32; 4], *const [i32; 4]>(array_ref) |
35 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]` |
| 34 | +LL | let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) }; |
| 35 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]` |
36 | 36 |
|
37 | 37 | error: transmute from `fn(usize) -> u8 {main::foo}` to `*const usize` which could be expressed as a pointer cast instead
|
38 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:58:9 |
| 38 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:49:41 |
39 | 39 | |
|
40 |
| -LL | transmute::<fn(usize) -> u8, *const usize>(foo) |
41 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize` |
| 40 | +LL | let _usize_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, *const usize>(foo) }; |
| 41 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize` |
42 | 42 |
|
43 | 43 | error: transmute from `fn(usize) -> u8 {main::foo}` to `usize` which could be expressed as a pointer cast instead
|
44 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:64:9 |
| 44 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:53:49 |
45 | 45 | |
|
46 |
| -LL | transmute::<fn(usize) -> u8, usize>(foo) |
47 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize` |
| 46 | +LL | let _usize_from_fn_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, usize>(foo) }; |
| 47 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize` |
48 | 48 |
|
49 | 49 | error: transmute from a reference to a pointer
|
50 |
| - --> $DIR/transmutes_expressible_as_ptr_casts.rs:77:14 |
| 50 | + --> $DIR/transmutes_expressible_as_ptr_casts.rs:65:14 |
51 | 51 | |
|
52 | 52 | LL | unsafe { transmute::<&[i32; 1], *const u8>(in_param) }
|
53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8`
|
|
0 commit comments