@@ -2,170 +2,206 @@ warning: transmuting an integer to a pointer creates a pointer without provenanc
2
2
--> $DIR/int_to_ptr.rs:10:36
3
3
|
4
4
LL | let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) };
5
- | ----------------------------------------^^
6
- | |
7
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8
6
|
9
7
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
10
8
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
11
9
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
12
10
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
13
11
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
14
12
= note: `#[warn(integer_to_ptr_transmutes)]` on by default
13
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
14
+ |
15
+ LL - let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) };
16
+ LL + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) };
17
+ |
15
18
16
19
warning: transmuting an integer to a pointer creates a pointer without provenance
17
20
--> $DIR/int_to_ptr.rs:12:34
18
21
|
19
22
LL | let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) };
20
- | --------------------------------------^^
21
- | |
22
- | help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance_mut::<u8>(`
23
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23
24
|
24
25
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
25
26
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
26
27
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
27
28
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
28
29
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
30
+ help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance
31
+ |
32
+ LL - let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) };
33
+ LL + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) };
34
+ |
29
35
30
36
warning: transmuting an integer to a pointer creates a pointer without provenance
31
37
--> $DIR/int_to_ptr.rs:14:38
32
38
|
33
39
LL | let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) };
34
- | ------------------------------------------^^
35
- | |
36
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `&*std::ptr::with_exposed_provenance::<u8>(`
40
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37
41
|
38
42
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
39
43
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
40
44
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
41
45
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
42
46
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
47
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
48
+ |
49
+ LL - let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) };
50
+ LL + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) };
51
+ |
43
52
44
53
warning: transmuting an integer to a pointer creates a pointer without provenance
45
54
--> $DIR/int_to_ptr.rs:16:42
46
55
|
47
56
LL | let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) };
48
- | ----------------------------------------------^^
49
- | |
50
- | help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance: `&mut *std::ptr::with_exposed_provenance_mut::<u8>(`
57
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51
58
|
52
59
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
53
60
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
54
61
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
55
62
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
56
63
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
64
+ help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance
65
+ |
66
+ LL - let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) };
67
+ LL + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) };
68
+ |
57
69
58
70
warning: transmuting an integer to a pointer creates a pointer without provenance
59
71
--> $DIR/int_to_ptr.rs:19:25
60
72
|
61
73
LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) };
62
- | ----------------------------------------^^^^^^^^
63
- | |
64
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
74
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65
75
|
66
76
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
67
77
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
68
78
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
69
79
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
70
80
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
81
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
82
+ |
83
+ LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) };
84
+ LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) };
85
+ |
71
86
72
87
warning: transmuting an integer to a pointer creates a pointer without provenance
73
88
--> $DIR/int_to_ptr.rs:21:25
74
89
|
75
90
LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) };
76
- | ----------------------------------------^^^^^^
77
- | |
78
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
91
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
79
92
|
80
93
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
81
94
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
82
95
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
83
96
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
84
97
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
98
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
99
+ |
100
+ LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) };
101
+ LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) };
102
+ |
85
103
86
104
warning: transmuting an integer to a pointer creates a pointer without provenance
87
105
--> $DIR/int_to_ptr.rs:26:36
88
106
|
89
107
LL | let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) };
90
- | ----------------------------------------^^
91
- | |
92
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
108
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93
109
|
94
110
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
95
111
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
96
112
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
97
113
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
98
114
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
115
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
116
+ |
117
+ LL - let _ptr: *const u8 = unsafe { std::mem::transmute::<usize, *const u8>(a) };
118
+ LL + let _ptr: *const u8 = unsafe { std::ptr::with_exposed_provenance::<u8>(a) };
119
+ |
99
120
100
121
warning: transmuting an integer to a pointer creates a pointer without provenance
101
122
--> $DIR/int_to_ptr.rs:28:34
102
123
|
103
124
LL | let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) };
104
- | --------------------------------------^^
105
- | |
106
- | help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance_mut::<u8>(`
125
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107
126
|
108
127
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
109
128
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
110
129
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
111
130
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
112
131
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
132
+ help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance
133
+ |
134
+ LL - let _ptr: *mut u8 = unsafe { std::mem::transmute::<usize, *mut u8>(a) };
135
+ LL + let _ptr: *mut u8 = unsafe { std::ptr::with_exposed_provenance_mut::<u8>(a) };
136
+ |
113
137
114
138
warning: transmuting an integer to a pointer creates a pointer without provenance
115
139
--> $DIR/int_to_ptr.rs:30:38
116
140
|
117
141
LL | let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) };
118
- | ------------------------------------------^^
119
- | |
120
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `&*std::ptr::with_exposed_provenance::<u8>(`
142
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121
143
|
122
144
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
123
145
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
124
146
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
125
147
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
126
148
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
149
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
150
+ |
151
+ LL - let _ref: &'static u8 = unsafe { std::mem::transmute::<usize, &'static u8>(a) };
152
+ LL + let _ref: &'static u8 = unsafe { &*std::ptr::with_exposed_provenance::<u8>(a) };
153
+ |
127
154
128
155
warning: transmuting an integer to a pointer creates a pointer without provenance
129
156
--> $DIR/int_to_ptr.rs:32:42
130
157
|
131
158
LL | let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) };
132
- | ----------------------------------------------^^
133
- | |
134
- | help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance: `&mut *std::ptr::with_exposed_provenance_mut::<u8>(`
159
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135
160
|
136
161
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
137
162
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
138
163
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
139
164
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
140
165
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
166
+ help: use `std::ptr::with_exposed_provenance_mut` instead to use a previously exposed provenance
167
+ |
168
+ LL - let _ref: &'static mut u8 = unsafe { std::mem::transmute::<usize, &'static mut u8>(a) };
169
+ LL + let _ref: &'static mut u8 = unsafe { &mut *std::ptr::with_exposed_provenance_mut::<u8>(a) };
170
+ |
141
171
142
172
warning: transmuting an integer to a pointer creates a pointer without provenance
143
173
--> $DIR/int_to_ptr.rs:35:25
144
174
|
145
175
LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) };
146
- | ----------------------------------------^^^^^^^^
147
- | |
148
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
176
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149
177
|
150
178
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
151
179
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
152
180
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
153
181
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
154
182
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
183
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
184
+ |
185
+ LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(42usize) };
186
+ LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(42usize) };
187
+ |
155
188
156
189
warning: transmuting an integer to a pointer creates a pointer without provenance
157
190
--> $DIR/int_to_ptr.rs:37:25
158
191
|
159
192
LL | let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) };
160
- | ----------------------------------------^^^^^^
161
- | |
162
- | help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance: `std::ptr::with_exposed_provenance::<u8>(`
193
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163
194
|
164
195
= note: this is dangerous because dereferencing the resulting pointer is undefined behavior
165
196
= note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
166
197
= help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
167
198
= help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
168
199
= help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
200
+ help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance
201
+ |
202
+ LL - let _ptr = unsafe { std::mem::transmute::<usize, *const u8>(a + a) };
203
+ LL + let _ptr = unsafe { std::ptr::with_exposed_provenance::<u8>(a + a) };
204
+ |
169
205
170
206
warning: 12 warnings emitted
171
207
0 commit comments