summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr
blob: de9418c8d1adc4af6ab0e578ef3697b2a95a1c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
error: transmute from an integer to a pointer
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:18:39
   |
LL |     let _ptr_i32_transmute = unsafe { transmute::<usize, *const i32>(usize::MAX) };
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32`
   |
   = note: `-D clippy::useless-transmute` implied by `-D warnings`

error: transmute from a pointer to a pointer
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:22:38
   |
LL |     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as *const i8`
   |
   = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`

error: transmute from a pointer to a pointer
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:28:46
   |
LL |     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice_ptr as *const [u32]`

error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:34:50
   |
LL |     let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) };
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize`
   |
   = note: `-D clippy::transmutes-expressible-as-ptr-casts` implied by `-D warnings`

error: transmute from a reference to a pointer
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:40:41
   |
LL |     let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]`

error: transmute from `fn(usize) -> u8` to `*const usize` which could be expressed as a pointer cast instead
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:48:41
   |
LL |     let _usize_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, *const usize>(foo) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize`

error: transmute from `fn(usize) -> u8` to `usize` which could be expressed as a pointer cast instead
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:52:49
   |
LL |     let _usize_from_fn_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, usize>(foo) };
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize`

error: transmute from a reference to a pointer
  --> $DIR/transmutes_expressible_as_ptr_casts.rs:64:14
   |
LL |     unsafe { transmute::<&[i32; 1], *const u8>(in_param) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8`

error: aborting due to 8 previous errors