@@ -24,223 +24,123 @@ error: transmute from a reference to a pointer
2424LL | let _: *const U = core::intrinsics::transmute(t);
2525 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U`
2626
27- error: transmute from a pointer type (`*const T`) to a reference type (`&T`)
28- --> $DIR/transmute.rs:32:17
29- |
30- LL | let _: &T = std::mem::transmute(p);
31- | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p`
32- |
33- = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings`
34-
35- error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
36- --> $DIR/transmute.rs:35:21
37- |
38- LL | let _: &mut T = std::mem::transmute(m);
39- | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m`
40-
41- error: transmute from a pointer type (`*mut T`) to a reference type (`&T`)
42- --> $DIR/transmute.rs:38:17
43- |
44- LL | let _: &T = std::mem::transmute(m);
45- | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m`
46-
47- error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
48- --> $DIR/transmute.rs:41:21
49- |
50- LL | let _: &mut T = std::mem::transmute(p as *mut T);
51- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)`
52-
53- error: transmute from a pointer type (`*const U`) to a reference type (`&T`)
54- --> $DIR/transmute.rs:44:17
55- |
56- LL | let _: &T = std::mem::transmute(o);
57- | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)`
58-
59- error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`)
60- --> $DIR/transmute.rs:47:21
61- |
62- LL | let _: &mut T = std::mem::transmute(om);
63- | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)`
64-
65- error: transmute from a pointer type (`*mut U`) to a reference type (`&T`)
66- --> $DIR/transmute.rs:50:17
67- |
68- LL | let _: &T = std::mem::transmute(om);
69- | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`
70-
71- error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`)
72- --> $DIR/transmute.rs:61:32
73- |
74- LL | let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
75- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<_>)`
76-
77- error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`)
78- --> $DIR/transmute.rs:63:33
79- |
80- LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
81- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<&_>)`
82-
83- error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`)
84- --> $DIR/transmute.rs:67:14
85- |
86- LL | unsafe { std::mem::transmute::<_, Bar>(raw) };
87- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)`
88-
8927error: transmute from a type (`std::vec::Vec<i32>`) to itself
90- --> $DIR/transmute.rs:73 :27
28+ --> $DIR/transmute.rs:33 :27
9129 |
9230LL | let _: Vec<i32> = core::intrinsics::transmute(my_vec());
9331 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9432
9533error: transmute from a type (`std::vec::Vec<i32>`) to itself
96- --> $DIR/transmute.rs:75 :27
34+ --> $DIR/transmute.rs:35 :27
9735 |
9836LL | let _: Vec<i32> = core::mem::transmute(my_vec());
9937 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10038
10139error: transmute from a type (`std::vec::Vec<i32>`) to itself
102- --> $DIR/transmute.rs:77 :27
40+ --> $DIR/transmute.rs:37 :27
10341 |
10442LL | let _: Vec<i32> = std::intrinsics::transmute(my_vec());
10543 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10644
10745error: transmute from a type (`std::vec::Vec<i32>`) to itself
108- --> $DIR/transmute.rs:79 :27
46+ --> $DIR/transmute.rs:39 :27
10947 |
11048LL | let _: Vec<i32> = std::mem::transmute(my_vec());
11149 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11250
11351error: transmute from a type (`std::vec::Vec<i32>`) to itself
114- --> $DIR/transmute.rs:81 :27
52+ --> $DIR/transmute.rs:41 :27
11553 |
11654LL | let _: Vec<i32> = my_transmute(my_vec());
11755 | ^^^^^^^^^^^^^^^^^^^^^^
11856
11957error: transmute from an integer to a pointer
120- --> $DIR/transmute.rs:83 :31
58+ --> $DIR/transmute.rs:43 :31
12159 |
12260LL | let _: *const usize = std::mem::transmute(5_isize);
12361 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize`
12462
12563error: transmute from an integer to a pointer
126- --> $DIR/transmute.rs:87 :31
64+ --> $DIR/transmute.rs:47 :31
12765 |
12866LL | let _: *const usize = std::mem::transmute(1 + 1usize);
12967 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1 + 1usize) as *const usize`
13068
13169error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`)
132- --> $DIR/transmute.rs:102 :24
70+ --> $DIR/transmute.rs:62 :24
13371 |
13472LL | let _: Usize = core::intrinsics::transmute(int_const_ptr);
13573 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13674 |
13775 = note: `-D clippy::crosspointer-transmute` implied by `-D warnings`
13876
13977error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`)
140- --> $DIR/transmute.rs:104 :24
78+ --> $DIR/transmute.rs:64 :24
14179 |
14280LL | let _: Usize = core::intrinsics::transmute(int_mut_ptr);
14381 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14482
14583error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`)
146- --> $DIR/transmute.rs:106 :31
84+ --> $DIR/transmute.rs:66 :31
14785 |
14886LL | let _: *const Usize = core::intrinsics::transmute(my_int());
14987 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15088
15189error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`)
152- --> $DIR/transmute.rs:108 :29
90+ --> $DIR/transmute.rs:68 :29
15391 |
15492LL | let _: *mut Usize = core::intrinsics::transmute(my_int());
15593 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15694
15795error: transmute from a `u32` to a `char`
158- --> $DIR/transmute.rs:114 :28
96+ --> $DIR/transmute.rs:74 :28
15997 |
16098LL | let _: char = unsafe { std::mem::transmute(0_u32) };
16199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()`
162100 |
163101 = note: `-D clippy::transmute-int-to-char` implied by `-D warnings`
164102
165103error: transmute from a `i32` to a `char`
166- --> $DIR/transmute.rs:115 :28
104+ --> $DIR/transmute.rs:75 :28
167105 |
168106LL | let _: char = unsafe { std::mem::transmute(0_i32) };
169107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()`
170108
171109error: transmute from a `u8` to a `bool`
172- --> $DIR/transmute.rs:120 :28
110+ --> $DIR/transmute.rs:80 :28
173111 |
174112LL | let _: bool = unsafe { std::mem::transmute(0_u8) };
175113 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0`
176114 |
177115 = note: `-D clippy::transmute-int-to-bool` implied by `-D warnings`
178116
179117error: transmute from a `u32` to a `f32`
180- --> $DIR/transmute.rs:125 :27
118+ --> $DIR/transmute.rs:85 :27
181119 |
182120LL | let _: f32 = unsafe { std::mem::transmute(0_u32) };
183121 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)`
184122 |
185123 = note: `-D clippy::transmute-int-to-float` implied by `-D warnings`
186124
187125error: transmute from a `i32` to a `f32`
188- --> $DIR/transmute.rs:126 :27
126+ --> $DIR/transmute.rs:86 :27
189127 |
190128LL | let _: f32 = unsafe { std::mem::transmute(0_i32) };
191129 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)`
192130
193131error: transmute from a `&[u8]` to a `&str`
194- --> $DIR/transmute.rs:130 :28
132+ --> $DIR/transmute.rs:90 :28
195133 |
196134LL | let _: &str = unsafe { std::mem::transmute(b) };
197135 | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(b).unwrap()`
198136 |
199137 = note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings`
200138
201139error: transmute from a `&mut [u8]` to a `&mut str`
202- --> $DIR/transmute.rs:131 :32
140+ --> $DIR/transmute.rs:91 :32
203141 |
204142LL | let _: &mut str = unsafe { std::mem::transmute(mb) };
205143 | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`
206144
207- error: transmute from a pointer to a pointer
208- --> $DIR/transmute.rs:163:29
209- |
210- LL | let _: *const f32 = std::mem::transmute(ptr);
211- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32`
212- |
213- = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
214-
215- error: transmute from a pointer to a pointer
216- --> $DIR/transmute.rs:164:27
217- |
218- LL | let _: *mut f32 = std::mem::transmute(mut_ptr);
219- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mut_ptr as *mut f32`
220-
221- error: transmute from a reference to a reference
222- --> $DIR/transmute.rs:166:23
223- |
224- LL | let _: &f32 = std::mem::transmute(&1u32);
225- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
226-
227- error: transmute from a reference to a reference
228- --> $DIR/transmute.rs:167:23
229- |
230- LL | let _: &f64 = std::mem::transmute(&1f32);
231- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64)`
232-
233- error: transmute from a reference to a reference
234- --> $DIR/transmute.rs:170:27
235- |
236- LL | let _: &mut f32 = std::mem::transmute(&mut 1u32);
237- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
238-
239- error: transmute from a reference to a reference
240- --> $DIR/transmute.rs:171:37
241- |
242- LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
243- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
244-
245- error: aborting due to 38 previous errors
145+ error: aborting due to 22 previous errors
246146
0 commit comments