You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/cast_slice_different_sizes.stderr
+34-16Lines changed: 34 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -46,58 +46,76 @@ error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (elem
46
46
--> $DIR/cast_slice_different_sizes.rs:38:27
47
47
|
48
48
LL | let long_chain_loss = r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const [u8];
49
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const u8, ..)`
49
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)`
50
50
51
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
51
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
52
52
--> $DIR/cast_slice_different_sizes.rs:53:36
53
53
|
54
54
LL | fn bar(x: *mut [u16]) -> *mut [u8] {
55
55
| ____________________________________^
56
56
LL | | x as *mut [u8]
57
57
LL | | }
58
-
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut mut u8, ..)`
58
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`
59
59
60
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
60
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
61
61
--> $DIR/cast_slice_different_sizes.rs:57:36
62
62
|
63
63
LL | fn uwu(x: *mut [u16]) -> *mut [u8] {
64
64
| ____________________________________^
65
65
LL | | x as *mut _
66
66
LL | | }
67
-
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut mut u8, ..)`
67
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`
68
68
69
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
69
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
70
70
--> $DIR/cast_slice_different_sizes.rs:61:37
71
71
|
72
72
LL | fn bar2(x: *mut [u16]) -> *mut [u8] {
73
73
| _____________________________________^
74
74
LL | | x as _
75
75
LL | | }
76
-
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut mut u8, ..)`
76
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`
77
77
78
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
78
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
79
79
--> $DIR/cast_slice_different_sizes.rs:66:39
80
80
|
81
+
LL | fn bar3(x: *mut [u16]) -> *const [u8] {
82
+
| _______________________________________^
83
+
LL | | x as _
84
+
LL | | }
85
+
| |_^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(x as *const u8, ..)`
86
+
87
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
88
+
--> $DIR/cast_slice_different_sizes.rs:71:39
89
+
|
90
+
LL | fn bar4(x: *const [u16]) -> *mut [u8] {
91
+
| _______________________________________^
92
+
LL | | x as _
93
+
LL | | }
94
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(x as *mut u8, ..)`
95
+
96
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
97
+
--> $DIR/cast_slice_different_sizes.rs:76:39
98
+
|
81
99
LL | fn blocks(x: *mut [u16]) -> *mut [u8] {
82
100
| _______________________________________^
83
101
LL | | ({ x }) as _
84
102
LL | | }
85
-
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut mut u8, ..)`
103
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`
86
104
87
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
88
-
--> $DIR/cast_slice_different_sizes.rs:70:44
105
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
106
+
--> $DIR/cast_slice_different_sizes.rs:80:44
89
107
|
90
108
LL | fn more_blocks(x: *mut [u16]) -> *mut [u8] {
91
109
| ____________________________________________^
92
110
LL | | { ({ x }) as _ }
93
111
LL | | }
94
-
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut mut u8, ..)`
112
+
| |_^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`
95
113
96
-
error: casting between raw pointers to `[mut u16]` (element size 2) and `[mut u8]` (element size 1) does not adjust the count
97
-
--> $DIR/cast_slice_different_sizes.rs:71:5
114
+
error: casting between raw pointers to `[u16]` (element size 2) and `[u8]` (element size 1) does not adjust the count
115
+
--> $DIR/cast_slice_different_sizes.rs:81:5
98
116
|
99
117
LL | { ({ x }) as _ }
100
-
| ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut mut u8, ..)`
118
+
| ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts_mut`: `core::ptr::slice_from_raw_parts_mut(({ x }) as *mut u8, ..)`
0 commit comments