11error: transmute from a pointer to a pointer
2- --> tests/ui/transmute_ptr_to_ptr.rs:32 :29
2+ --> tests/ui/transmute_ptr_to_ptr.rs:34 :29
33 |
4- LL | let _: *const f32 = transmute(ptr);
5- | ^^^^^^^^^^^^^^
4+ LL | let _: *const f32 = transmute(Ptr( ptr) );
5+ | ^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
88 = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
99help: use `pointer::cast` instead
1010 |
11+ LL - let _: *const f32 = transmute(Ptr(ptr));
12+ LL + let _: *const f32 = Ptr(ptr).0.cast::<f32>();
13+ |
14+
15+ error: transmute from a pointer to a pointer
16+ --> tests/ui/transmute_ptr_to_ptr.rs:36:29
17+ |
18+ LL | let _: *const f32 = transmute(ptr);
19+ | ^^^^^^^^^^^^^^
20+ |
21+ help: use `pointer::cast` instead
22+ |
1123LL - let _: *const f32 = transmute(ptr);
1224LL + let _: *const f32 = ptr.cast::<f32>();
1325 |
1426
1527error: transmute from a pointer to a pointer
16- --> tests/ui/transmute_ptr_to_ptr.rs:35 :27
28+ --> tests/ui/transmute_ptr_to_ptr.rs:39 :27
1729 |
1830LL | let _: *mut f32 = transmute(mut_ptr);
1931 | ^^^^^^^^^^^^^^^^^^
@@ -25,37 +37,37 @@ LL + let _: *mut f32 = mut_ptr.cast::<f32>();
2537 |
2638
2739error: transmute from a reference to a reference
28- --> tests/ui/transmute_ptr_to_ptr.rs:39 :23
40+ --> tests/ui/transmute_ptr_to_ptr.rs:43 :23
2941 |
3042LL | let _: &f32 = transmute(&1u32);
3143 | ^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
3244
3345error: transmute from a reference to a reference
34- --> tests/ui/transmute_ptr_to_ptr.rs:42 :23
46+ --> tests/ui/transmute_ptr_to_ptr.rs:46 :23
3547 |
3648LL | let _: &f32 = transmute(&1f64);
3749 | ^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)`
3850
3951error: transmute from a reference to a reference
40- --> tests/ui/transmute_ptr_to_ptr.rs:47 :27
52+ --> tests/ui/transmute_ptr_to_ptr.rs:51 :27
4153 |
4254LL | let _: &mut f32 = transmute(&mut 1u32);
4355 | ^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
4456
4557error: transmute from a reference to a reference
46- --> tests/ui/transmute_ptr_to_ptr.rs:50 :37
58+ --> tests/ui/transmute_ptr_to_ptr.rs:54 :37
4759 |
4860LL | let _: &GenericParam<f32> = transmute(&GenericParam { t: 1u32 });
4961 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
5062
5163error: transmute from a reference to a reference
52- --> tests/ui/transmute_ptr_to_ptr.rs:54 :27
64+ --> tests/ui/transmute_ptr_to_ptr.rs:58 :27
5365 |
5466LL | let u8_ref: &u8 = transmute(u64_ref);
5567 | ^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)`
5668
5769error: transmute from a pointer to a pointer
58- --> tests/ui/transmute_ptr_to_ptr.rs:57 :29
70+ --> tests/ui/transmute_ptr_to_ptr.rs:61 :29
5971 |
6072LL | let _: *const u32 = transmute(mut_ptr);
6173 | ^^^^^^^^^^^^^^^^^^
@@ -67,7 +79,7 @@ LL + let _: *const u32 = mut_ptr.cast_const();
6779 |
6880
6981error: transmute from a pointer to a pointer
70- --> tests/ui/transmute_ptr_to_ptr.rs:60 :27
82+ --> tests/ui/transmute_ptr_to_ptr.rs:64 :27
7183 |
7284LL | let _: *mut u32 = transmute(ptr);
7385 | ^^^^^^^^^^^^^^
@@ -79,7 +91,19 @@ LL + let _: *mut u32 = ptr.cast_mut();
7991 |
8092
8193error: transmute from a pointer to a pointer
82- --> tests/ui/transmute_ptr_to_ptr.rs:72:14
94+ --> tests/ui/transmute_ptr_to_ptr.rs:66:27
95+ |
96+ LL | let _: *mut u32 = transmute(Ptr(ptr));
97+ | ^^^^^^^^^^^^^^^^^^^
98+ |
99+ help: use `pointer::cast_mut` instead
100+ |
101+ LL - let _: *mut u32 = transmute(Ptr(ptr));
102+ LL + let _: *mut u32 = Ptr(ptr).0.cast_mut();
103+ |
104+
105+ error: transmute from a pointer to a pointer
106+ --> tests/ui/transmute_ptr_to_ptr.rs:78:14
83107 |
84108LL | unsafe { transmute(v) }
85109 | ^^^^^^^^^^^^
@@ -91,7 +115,19 @@ LL + unsafe { v as *const &() }
91115 |
92116
93117error: transmute from a pointer to a pointer
94- --> tests/ui/transmute_ptr_to_ptr.rs:87:28
118+ --> tests/ui/transmute_ptr_to_ptr.rs:95:28
119+ |
120+ LL | let _: *const i8 = transmute(Ptr8(ptr));
121+ | ^^^^^^^^^^^^^^^^^^^^
122+ |
123+ help: use an `as` cast instead
124+ |
125+ LL - let _: *const i8 = transmute(Ptr8(ptr));
126+ LL + let _: *const i8 = Ptr8(ptr).0 as *const i8;
127+ |
128+
129+ error: transmute from a pointer to a pointer
130+ --> tests/ui/transmute_ptr_to_ptr.rs:97:28
95131 |
96132LL | let _: *const i8 = transmute(ptr);
97133 | ^^^^^^^^^^^^^^
@@ -103,7 +139,7 @@ LL + let _: *const i8 = ptr as *const i8;
103139 |
104140
105141error: transmute from a pointer to a pointer
106- --> tests/ui/transmute_ptr_to_ptr.rs:95 :28
142+ --> tests/ui/transmute_ptr_to_ptr.rs:105 :28
107143 |
108144LL | let _: *const i8 = transmute(ptr);
109145 | ^^^^^^^^^^^^^^
@@ -115,7 +151,7 @@ LL + let _: *const i8 = ptr.cast::<i8>();
115151 |
116152
117153error: transmute from a pointer to a pointer
118- --> tests/ui/transmute_ptr_to_ptr.rs:103 :26
154+ --> tests/ui/transmute_ptr_to_ptr.rs:113 :26
119155 |
120156LL | let _: *mut u8 = transmute(ptr);
121157 | ^^^^^^^^^^^^^^
@@ -127,7 +163,7 @@ LL + let _: *mut u8 = ptr as *mut u8;
127163 |
128164
129165error: transmute from a pointer to a pointer
130- --> tests/ui/transmute_ptr_to_ptr.rs:105 :28
166+ --> tests/ui/transmute_ptr_to_ptr.rs:115 :28
131167 |
132168LL | let _: *const u8 = transmute(mut_ptr);
133169 | ^^^^^^^^^^^^^^^^^^
@@ -139,7 +175,7 @@ LL + let _: *const u8 = mut_ptr as *const u8;
139175 |
140176
141177error: transmute from a pointer to a pointer
142- --> tests/ui/transmute_ptr_to_ptr.rs:113 :26
178+ --> tests/ui/transmute_ptr_to_ptr.rs:123 :26
143179 |
144180LL | let _: *mut u8 = transmute(ptr);
145181 | ^^^^^^^^^^^^^^
@@ -151,7 +187,7 @@ LL + let _: *mut u8 = ptr.cast_mut();
151187 |
152188
153189error: transmute from a pointer to a pointer
154- --> tests/ui/transmute_ptr_to_ptr.rs:115 :28
190+ --> tests/ui/transmute_ptr_to_ptr.rs:125 :28
155191 |
156192LL | let _: *const u8 = transmute(mut_ptr);
157193 | ^^^^^^^^^^^^^^^^^^
@@ -162,5 +198,5 @@ LL - let _: *const u8 = transmute(mut_ptr);
162198LL + let _: *const u8 = mut_ptr.cast_const();
163199 |
164200
165- error: aborting due to 16 previous errors
201+ error: aborting due to 19 previous errors
166202
0 commit comments