fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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