2022-03-14 11:02:53 +00:00
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:10:13
2022-03-14 11:02:53 +00:00
|
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:13:13
2022-03-14 11:02:53 +00:00
|
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:17:16
2022-03-14 11:02:53 +00:00
|
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:25:24
2022-03-14 11:02:53 +00:00
|
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:27:24
2022-03-14 11:02:53 +00:00
|
LL | let loss_block_2 = {
| ________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-03-14 11:02:53 +00:00
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({
2023-08-24 19:32:12 +00:00
LL +
2022-03-14 11:02:53 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:45:27
2022-03-14 11:02:53 +00:00
|
LL | let long_chain_loss = r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const [u8];
2022-05-05 14:12:52 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)`
2022-03-14 11:02:53 +00:00
2022-05-05 14:12:52 +00:00
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:61:36
2022-05-05 14:12:52 +00:00
|
LL | fn bar(x: *mut [u16]) -> *mut [u8] {
| ____________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:66:36
2022-05-05 14:12:52 +00:00
|
LL | fn uwu(x: *mut [u16]) -> *mut [u8] {
| ____________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:71:37
2022-05-05 14:12:52 +00:00
|
LL | fn bar2(x: *mut [u16]) -> *mut [u8] {
| _____________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:77:39
2022-05-05 14:12:52 +00:00
|
LL | fn bar3(x: *mut [u16]) -> *const [u8] {
| _______________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:83:39
2022-05-05 14:12:52 +00:00
|
LL | fn bar4(x: *const [u16]) -> *mut [u8] {
| _______________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:89:39
2022-05-05 14:12:52 +00:00
|
LL | fn blocks(x: *mut [u16]) -> *mut [u8] {
| _______________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:94:44
2022-05-05 14:12:52 +00:00
|
LL | fn more_blocks(x: *mut [u16]) -> *mut [u8] {
| ____________________________________________^
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
LL | | { ({ x }) as _ }
2023-08-24 19:32:12 +00:00
LL | |
2022-05-05 14:12:52 +00:00
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
2023-08-24 19:32:12 +00:00
--> $DIR/cast_slice_different_sizes.rs:96:5
2022-05-05 14:12:52 +00:00
|
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
2022-03-14 11:02:53 +00:00