]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/transmute.stderr
Rollup merge of #100076 - tspiteri:const_slice_split_at, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / transmute.stderr
1 error: transmute from a reference to a pointer
2   --> $DIR/transmute.rs:24:23
3    |
4 LL |     let _: *const T = core::intrinsics::transmute(t);
5    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T`
6    |
7    = note: `-D clippy::useless-transmute` implied by `-D warnings`
8
9 error: transmute from a reference to a pointer
10   --> $DIR/transmute.rs:26:21
11    |
12 LL |     let _: *mut T = core::intrinsics::transmute(t);
13    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T`
14
15 error: transmute from a reference to a pointer
16   --> $DIR/transmute.rs:28:23
17    |
18 LL |     let _: *const U = core::intrinsics::transmute(t);
19    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U`
20
21 error: transmute from a type (`std::vec::Vec<i32>`) to itself
22   --> $DIR/transmute.rs:34:27
23    |
24 LL |         let _: Vec<i32> = core::intrinsics::transmute(my_vec());
25    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27 error: transmute from a type (`std::vec::Vec<i32>`) to itself
28   --> $DIR/transmute.rs:36:27
29    |
30 LL |         let _: Vec<i32> = core::mem::transmute(my_vec());
31    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32
33 error: transmute from a type (`std::vec::Vec<i32>`) to itself
34   --> $DIR/transmute.rs:38:27
35    |
36 LL |         let _: Vec<i32> = std::intrinsics::transmute(my_vec());
37    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
39 error: transmute from a type (`std::vec::Vec<i32>`) to itself
40   --> $DIR/transmute.rs:40:27
41    |
42 LL |         let _: Vec<i32> = std::mem::transmute(my_vec());
43    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
45 error: transmute from a type (`std::vec::Vec<i32>`) to itself
46   --> $DIR/transmute.rs:42:27
47    |
48 LL |         let _: Vec<i32> = my_transmute(my_vec());
49    |                           ^^^^^^^^^^^^^^^^^^^^^^
50
51 error: transmute from an integer to a pointer
52   --> $DIR/transmute.rs:44:31
53    |
54 LL |         let _: *const usize = std::mem::transmute(5_isize);
55    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize`
56
57 error: transmute from an integer to a pointer
58   --> $DIR/transmute.rs:48:31
59    |
60 LL |         let _: *const usize = std::mem::transmute(1 + 1usize);
61    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1 + 1usize) as *const usize`
62
63 error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`)
64   --> $DIR/transmute.rs:79:24
65    |
66 LL |         let _: Usize = core::intrinsics::transmute(int_const_ptr);
67    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68    |
69    = note: `-D clippy::crosspointer-transmute` implied by `-D warnings`
70
71 error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`)
72   --> $DIR/transmute.rs:81:24
73    |
74 LL |         let _: Usize = core::intrinsics::transmute(int_mut_ptr);
75    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76
77 error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`)
78   --> $DIR/transmute.rs:83:31
79    |
80 LL |         let _: *const Usize = core::intrinsics::transmute(my_int());
81    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82
83 error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`)
84   --> $DIR/transmute.rs:85:29
85    |
86 LL |         let _: *mut Usize = core::intrinsics::transmute(my_int());
87    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89 error: transmute from a `u32` to a `char`
90   --> $DIR/transmute.rs:91:28
91    |
92 LL |     let _: char = unsafe { std::mem::transmute(0_u32) };
93    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()`
94    |
95    = note: `-D clippy::transmute-int-to-char` implied by `-D warnings`
96
97 error: transmute from a `i32` to a `char`
98   --> $DIR/transmute.rs:92:28
99    |
100 LL |     let _: char = unsafe { std::mem::transmute(0_i32) };
101    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()`
102
103 error: transmute from a `u8` to a `bool`
104   --> $DIR/transmute.rs:101:28
105    |
106 LL |     let _: bool = unsafe { std::mem::transmute(0_u8) };
107    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0`
108    |
109    = note: `-D clippy::transmute-int-to-bool` implied by `-D warnings`
110
111 error: transmute from a `u32` to a `f32`
112   --> $DIR/transmute.rs:107:31
113    |
114 LL |         let _: f32 = unsafe { std::mem::transmute(0_u32) };
115    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)`
116    |
117    = note: `-D clippy::transmute-int-to-float` implied by `-D warnings`
118
119 error: transmute from a `i32` to a `f32`
120   --> $DIR/transmute.rs:108:31
121    |
122 LL |         let _: f32 = unsafe { std::mem::transmute(0_i32) };
123    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)`
124
125 error: transmute from a `u64` to a `f64`
126   --> $DIR/transmute.rs:109:31
127    |
128 LL |         let _: f64 = unsafe { std::mem::transmute(0_u64) };
129    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_u64)`
130
131 error: transmute from a `i64` to a `f64`
132   --> $DIR/transmute.rs:110:31
133    |
134 LL |         let _: f64 = unsafe { std::mem::transmute(0_i64) };
135    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_i64 as u64)`
136
137 error: transmute from a `u8` to a `[u8; 1]`
138   --> $DIR/transmute.rs:130:30
139    |
140 LL |             let _: [u8; 1] = std::mem::transmute(0u8);
141    |                              ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()`
142    |
143    = note: `-D clippy::transmute-num-to-bytes` implied by `-D warnings`
144
145 error: transmute from a `u32` to a `[u8; 4]`
146   --> $DIR/transmute.rs:131:30
147    |
148 LL |             let _: [u8; 4] = std::mem::transmute(0u32);
149    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()`
150
151 error: transmute from a `u128` to a `[u8; 16]`
152   --> $DIR/transmute.rs:132:31
153    |
154 LL |             let _: [u8; 16] = std::mem::transmute(0u128);
155    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()`
156
157 error: transmute from a `i8` to a `[u8; 1]`
158   --> $DIR/transmute.rs:133:30
159    |
160 LL |             let _: [u8; 1] = std::mem::transmute(0i8);
161    |                              ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()`
162
163 error: transmute from a `i32` to a `[u8; 4]`
164   --> $DIR/transmute.rs:134:30
165    |
166 LL |             let _: [u8; 4] = std::mem::transmute(0i32);
167    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()`
168
169 error: transmute from a `i128` to a `[u8; 16]`
170   --> $DIR/transmute.rs:135:31
171    |
172 LL |             let _: [u8; 16] = std::mem::transmute(0i128);
173    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()`
174
175 error: transmute from a `f32` to a `[u8; 4]`
176   --> $DIR/transmute.rs:136:30
177    |
178 LL |             let _: [u8; 4] = std::mem::transmute(0.0f32);
179    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f32.to_ne_bytes()`
180
181 error: transmute from a `f64` to a `[u8; 8]`
182   --> $DIR/transmute.rs:137:30
183    |
184 LL |             let _: [u8; 8] = std::mem::transmute(0.0f64);
185    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f64.to_ne_bytes()`
186
187 error: transmute from a `u8` to a `[u8; 1]`
188   --> $DIR/transmute.rs:142:30
189    |
190 LL |             let _: [u8; 1] = std::mem::transmute(0u8);
191    |                              ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()`
192
193 error: transmute from a `u32` to a `[u8; 4]`
194   --> $DIR/transmute.rs:143:30
195    |
196 LL |             let _: [u8; 4] = std::mem::transmute(0u32);
197    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()`
198
199 error: transmute from a `u128` to a `[u8; 16]`
200   --> $DIR/transmute.rs:144:31
201    |
202 LL |             let _: [u8; 16] = std::mem::transmute(0u128);
203    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()`
204
205 error: transmute from a `i8` to a `[u8; 1]`
206   --> $DIR/transmute.rs:145:30
207    |
208 LL |             let _: [u8; 1] = std::mem::transmute(0i8);
209    |                              ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()`
210
211 error: transmute from a `i32` to a `[u8; 4]`
212   --> $DIR/transmute.rs:146:30
213    |
214 LL |             let _: [u8; 4] = std::mem::transmute(0i32);
215    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()`
216
217 error: transmute from a `i128` to a `[u8; 16]`
218   --> $DIR/transmute.rs:147:31
219    |
220 LL |             let _: [u8; 16] = std::mem::transmute(0i128);
221    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()`
222
223 error: transmute from a `&[u8]` to a `&str`
224   --> $DIR/transmute.rs:157:28
225    |
226 LL |     let _: &str = unsafe { std::mem::transmute(B) };
227    |                            ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(B).unwrap()`
228    |
229    = note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings`
230
231 error: transmute from a `&mut [u8]` to a `&mut str`
232   --> $DIR/transmute.rs:158:32
233    |
234 LL |     let _: &mut str = unsafe { std::mem::transmute(mb) };
235    |                                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`
236
237 error: transmute from a `&[u8]` to a `&str`
238   --> $DIR/transmute.rs:159:30
239    |
240 LL |     const _: &str = unsafe { std::mem::transmute(B) };
241    |                              ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_unchecked(B)`
242
243 error: aborting due to 38 previous errors
244