@@ -74,27 +74,27 @@ where
7474 where
7575 C : CallingConventionBase ,
7676 {
77- ffi_wrap ! ( "CallingConvention::free" , unsafe {
78- let _ctxt = Box :: from_raw( ctxt as * mut CustomCallingConventionContext <C >) ;
77+ ffi_wrap ! ( "CallingConvention::free" , {
78+ let _ctxt = unsafe { Box :: from_raw( ctxt as * mut CustomCallingConventionContext <C >) } ;
7979 } )
8080 }
8181
8282 extern "C" fn cb_free_register_list ( _ctxt : * mut c_void , regs : * mut u32 , count : usize ) {
83- ffi_wrap ! ( "CallingConvention::free_register_list" , unsafe {
83+ ffi_wrap ! ( "CallingConvention::free_register_list" , {
8484 if regs. is_null( ) {
8585 return ;
8686 }
8787
88- let _regs = Box :: from_raw( ptr:: slice_from_raw_parts_mut( regs, count) ) ;
88+ let _regs = unsafe { Box :: from_raw( ptr:: slice_from_raw_parts_mut( regs, count) ) } ;
8989 } )
9090 }
9191
9292 extern "C" fn cb_caller_saved < C > ( ctxt : * mut c_void , count : * mut usize ) -> * mut u32
9393 where
9494 C : CallingConventionBase ,
9595 {
96- ffi_wrap ! ( "CallingConvention::caller_saved_registers" , unsafe {
97- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
96+ ffi_wrap ! ( "CallingConvention::caller_saved_registers" , {
97+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
9898 let mut regs: Vec <_> = ctxt
9999 . cc
100100 . caller_saved_registers( )
@@ -114,8 +114,8 @@ where
114114 where
115115 C : CallingConventionBase ,
116116 {
117- ffi_wrap ! ( "CallingConvention::callee_saved_registers" , unsafe {
118- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
117+ ffi_wrap ! ( "CallingConvention::callee_saved_registers" , {
118+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
119119 let mut regs: Vec <_> = ctxt
120120 . cc
121121 . callee_saved_registers( )
@@ -135,8 +135,8 @@ where
135135 where
136136 C : CallingConventionBase ,
137137 {
138- ffi_wrap ! ( "CallingConvention::int_arg_registers" , unsafe {
139- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
138+ ffi_wrap ! ( "CallingConvention::int_arg_registers" , {
139+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
140140 let mut regs: Vec <_> = ctxt. cc. int_arg_registers( ) . iter( ) . map( |r| r. id( ) ) . collect( ) ;
141141
142142 // SAFETY: `count` is an out parameter
@@ -151,8 +151,8 @@ where
151151 where
152152 C : CallingConventionBase ,
153153 {
154- ffi_wrap ! ( "CallingConvention::float_arg_registers" , unsafe {
155- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
154+ ffi_wrap ! ( "CallingConvention::float_arg_registers" , {
155+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
156156 let mut regs: Vec <_> = ctxt
157157 . cc
158158 . float_arg_registers( )
@@ -172,9 +172,8 @@ where
172172 where
173173 C : CallingConventionBase ,
174174 {
175- ffi_wrap ! ( "CallingConvention::arg_registers_shared_index" , unsafe {
176- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
177-
175+ ffi_wrap ! ( "CallingConvention::arg_registers_shared_index" , {
176+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
178177 ctxt. cc. arg_registers_shared_index( )
179178 } )
180179 }
@@ -185,9 +184,8 @@ where
185184 {
186185 ffi_wrap ! (
187186 "CallingConvention::reserved_stack_space_for_arg_registers" ,
188- unsafe {
189- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
190-
187+ {
188+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
191189 ctxt. cc. reserved_stack_space_for_arg_registers( )
192190 }
193191 )
@@ -197,9 +195,8 @@ where
197195 where
198196 C : CallingConventionBase ,
199197 {
200- ffi_wrap ! ( "CallingConvention::stack_adjusted_on_return" , unsafe {
201- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
202-
198+ ffi_wrap ! ( "CallingConvention::stack_adjusted_on_return" , {
199+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
203200 ctxt. cc. stack_adjusted_on_return( )
204201 } )
205202 }
@@ -208,9 +205,8 @@ where
208205 where
209206 C : CallingConventionBase ,
210207 {
211- ffi_wrap ! ( "CallingConvention::is_eligible_for_heuristics" , unsafe {
212- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
213-
208+ ffi_wrap ! ( "CallingConvention::is_eligible_for_heuristics" , {
209+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
214210 ctxt. cc. is_eligible_for_heuristics( )
215211 } )
216212 }
@@ -219,9 +215,8 @@ where
219215 where
220216 C : CallingConventionBase ,
221217 {
222- ffi_wrap ! ( "CallingConvention::return_int_reg" , unsafe {
223- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
224-
218+ ffi_wrap ! ( "CallingConvention::return_int_reg" , {
219+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
225220 match ctxt. cc. return_int_reg( ) {
226221 Some ( r) => r. id( ) ,
227222 _ => 0xffff_ffff ,
@@ -233,9 +228,8 @@ where
233228 where
234229 C : CallingConventionBase ,
235230 {
236- ffi_wrap ! ( "CallingConvention::return_hi_int_reg" , unsafe {
237- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
238-
231+ ffi_wrap ! ( "CallingConvention::return_hi_int_reg" , {
232+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
239233 match ctxt. cc. return_hi_int_reg( ) {
240234 Some ( r) => r. id( ) ,
241235 _ => 0xffff_ffff ,
@@ -247,9 +241,8 @@ where
247241 where
248242 C : CallingConventionBase ,
249243 {
250- ffi_wrap ! ( "CallingConvention::return_float_reg" , unsafe {
251- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
252-
244+ ffi_wrap ! ( "CallingConvention::return_float_reg" , {
245+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
253246 match ctxt. cc. return_float_reg( ) {
254247 Some ( r) => r. id( ) ,
255248 _ => 0xffff_ffff ,
@@ -261,9 +254,8 @@ where
261254 where
262255 C : CallingConventionBase ,
263256 {
264- ffi_wrap ! ( "CallingConvention::global_pointer_reg" , unsafe {
265- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
266-
257+ ffi_wrap ! ( "CallingConvention::global_pointer_reg" , {
258+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
267259 match ctxt. cc. global_pointer_reg( ) {
268260 Some ( r) => r. id( ) ,
269261 _ => 0xffff_ffff ,
@@ -278,8 +270,8 @@ where
278270 where
279271 C : CallingConventionBase ,
280272 {
281- ffi_wrap ! ( "CallingConvention::implicitly_defined_registers" , unsafe {
282- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
273+ ffi_wrap ! ( "CallingConvention::implicitly_defined_registers" , {
274+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
283275 let mut regs: Vec <_> = ctxt
284276 . cc
285277 . implicitly_defined_registers( )
@@ -359,9 +351,8 @@ where
359351 {
360352 ffi_wrap ! (
361353 "CallingConvention::are_argument_registers_used_for_var_args" ,
362- unsafe {
363- let ctxt = & * ( ctxt as * mut CustomCallingConventionContext <C >) ;
364-
354+ {
355+ let ctxt = unsafe { & * ( ctxt as * mut CustomCallingConventionContext <C >) } ;
365356 ctxt. cc. are_argument_registers_used_for_var_args( )
366357 }
367358 )
0 commit comments