blob: c8db4fe214fdbd82b081e295fdfae61b5af23f43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:32:29
|
LL | let _: *const f32 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
help: use `pointer::cast` instead
|
LL - let _: *const f32 = transmute(ptr);
LL + let _: *const f32 = ptr.cast::<f32>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:35:27
|
LL | let _: *mut f32 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *mut f32 = transmute(mut_ptr);
LL + let _: *mut f32 = mut_ptr.cast::<f32>();
|
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:39:23
|
LL | let _: &f32 = transmute(&1u32);
| ^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:42:23
|
LL | let _: &f32 = transmute(&1f64);
| ^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:47:27
|
LL | let _: &mut f32 = transmute(&mut 1u32);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:50:37
|
LL | let _: &GenericParam<f32> = transmute(&GenericParam { t: 1u32 });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:54:27
|
LL | let u8_ref: &u8 = transmute(u64_ref);
| ^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)`
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:57:29
|
LL | let _: *const u32 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast_const` instead
|
LL - let _: *const u32 = transmute(mut_ptr);
LL + let _: *const u32 = mut_ptr.cast_const();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:60:27
|
LL | let _: *mut u32 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast_mut` instead
|
LL - let _: *mut u32 = transmute(ptr);
LL + let _: *mut u32 = ptr.cast_mut();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:72:14
|
LL | unsafe { transmute(v) }
| ^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - unsafe { transmute(v) }
LL + unsafe { v as *const &() }
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:87:28
|
LL | let _: *const i8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *const i8 = transmute(ptr);
LL + let _: *const i8 = ptr as *const i8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:95:28
|
LL | let _: *const i8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *const i8 = transmute(ptr);
LL + let _: *const i8 = ptr.cast::<i8>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:103:26
|
LL | let _: *mut u8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *mut u8 = transmute(ptr);
LL + let _: *mut u8 = ptr as *mut u8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:105:28
|
LL | let _: *const u8 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *const u8 = transmute(mut_ptr);
LL + let _: *const u8 = mut_ptr as *const u8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:113:26
|
LL | let _: *mut u8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast_mut` instead
|
LL - let _: *mut u8 = transmute(ptr);
LL + let _: *mut u8 = ptr.cast_mut();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:115:28
|
LL | let _: *const u8 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast_const` instead
|
LL - let _: *const u8 = transmute(mut_ptr);
LL + let _: *const u8 = mut_ptr.cast_const();
|
error: aborting due to 16 previous errors
|