@@ -2,170 +2,206 @@ warning: transmuting an integer to a pointer creates a pointer without provenanc
22 --> $DIR/int_to_ptr.rs:10:36
33 |
44LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86 |
97 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
108 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
119 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
1210 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
1311 = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
1412 = 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+ |
1518
1619warning: transmuting an integer to a pointer creates a pointer without provenance
1720 --> $DIR/int_to_ptr.rs:12:34
1821 |
1922LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2324 |
2425 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
2526 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
2627 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
2728 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
2829 = 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+ |
2935
3036warning: transmuting an integer to a pointer creates a pointer without provenance
3137 --> $DIR/int_to_ptr.rs:14:38
3238 |
3339LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3741 |
3842 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
3943 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
4044 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
4145 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
4246 = 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+ |
4352
4453warning: transmuting an integer to a pointer creates a pointer without provenance
4554 --> $DIR/int_to_ptr.rs:16:42
4655 |
4756LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5158 |
5259 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
5360 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
5461 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
5562 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
5663 = 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+ |
5769
5870warning: transmuting an integer to a pointer creates a pointer without provenance
5971 --> $DIR/int_to_ptr.rs:19:25
6072 |
6173LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6575 |
6676 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
6777 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
6878 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
6979 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
7080 = 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+ |
7186
7287warning: transmuting an integer to a pointer creates a pointer without provenance
7388 --> $DIR/int_to_ptr.rs:21:25
7489 |
7590LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7992 |
8093 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
8194 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
8295 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
8396 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
8497 = 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+ |
85103
86104warning: transmuting an integer to a pointer creates a pointer without provenance
87105 --> $DIR/int_to_ptr.rs:26:36
88106 |
89107LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93109 |
94110 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
95111 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
96112 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
97113 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
98114 = 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+ |
99120
100121warning: transmuting an integer to a pointer creates a pointer without provenance
101122 --> $DIR/int_to_ptr.rs:28:34
102123 |
103124LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107126 |
108127 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
109128 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
110129 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
111130 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
112131 = 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+ |
113137
114138warning: transmuting an integer to a pointer creates a pointer without provenance
115139 --> $DIR/int_to_ptr.rs:30:38
116140 |
117141LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121143 |
122144 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
123145 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
124146 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
125147 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
126148 = 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+ |
127154
128155warning: transmuting an integer to a pointer creates a pointer without provenance
129156 --> $DIR/int_to_ptr.rs:32:42
130157 |
131158LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135160 |
136161 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
137162 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
138163 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
139164 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
140165 = 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+ |
141171
142172warning: transmuting an integer to a pointer creates a pointer without provenance
143173 --> $DIR/int_to_ptr.rs:35:25
144174 |
145175LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149177 |
150178 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
151179 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
152180 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
153181 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
154182 = 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+ |
155188
156189warning: transmuting an integer to a pointer creates a pointer without provenance
157190 --> $DIR/int_to_ptr.rs:37:25
158191 |
159192LL | 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+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163194 |
164195 = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
165196 = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
166197 = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
167198 = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
168199 = 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+ |
169205
170206warning: 12 warnings emitted
171207
0 commit comments