summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/cast_slice_different_sizes.stderr
blob: 40721dcd05d5dbc909d140a82d70de3bfb28ddc7 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:9:13
   |
LL |     let b = a as *const [u8];
   |             ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(a as *const u8, ..)`
   |
   = note: `#[deny(clippy::cast_slice_different_sizes)]` on by default

error: casting between raw pointers to `[u8]` (element size 1) and `[u32]` (element size 4) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:10:13
   |
LL |     let c = b as *const [u32];
   |             ^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(b as *const u32, ..)`

error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:13:16
   |
LL |     let loss = r_x as *const [i32] as *const [u8];
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)`

error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:20:24
   |
LL |     let loss_block_1 = { r_x as *const [i32] } as *const [u8];
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts({ r_x as *const [i32] } as *const u8, ..)`

error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:21:24
   |
LL |       let loss_block_2 = {
   |  ________________________^
LL | |         let _ = ();
LL | |         r_x as *const [i32]
LL | |     } as *const [u8];
   | |____________________^
   |
help: replace with `ptr::slice_from_raw_parts`
   |
LL ~     let loss_block_2 = core::ptr::slice_from_raw_parts({
LL +         let _ = ();
LL +         r_x as *const [i32]
LL ~     } as *const u8, ..);
   |

error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:38:27
   |
LL |     let long_chain_loss = r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const [u8];
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:53:36
   |
LL |   fn bar(x: *mut [u16]) -> *mut [u8] {
   |  ____________________________________^
LL | |     x as *mut [u8]
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:57:36
   |
LL |   fn uwu(x: *mut [u16]) -> *mut [u8] {
   |  ____________________________________^
LL | |     x as *mut _
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:61:37
   |
LL |   fn bar2(x: *mut [u16]) -> *mut [u8] {
   |  _____________________________________^
LL | |     x as _
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:66:39
   |
LL |   fn bar3(x: *mut [u16]) -> *const [u8] {
   |  _______________________________________^
LL | |     x as _
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(x as *const u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:71:39
   |
LL |   fn bar4(x: *const [u16]) -> *mut [u8] {
   |  _______________________________________^
LL | |     x as _
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:76:39
   |
LL |   fn blocks(x: *mut [u16]) -> *mut [u8] {
   |  _______________________________________^
LL | |     ({ x }) as _
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:80:44
   |
LL |   fn more_blocks(x: *mut [u16]) -> *mut [u8] {
   |  ____________________________________________^
LL | |     { ({ x }) as _ }
LL | | }
   | |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`

error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
  --> $DIR/cast_slice_different_sizes.rs:81:5
   |
LL |     { ({ x }) as _ }
   |     ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`

error: aborting due to 14 previous errors