File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -527,16 +527,15 @@ fn expand_cxx_function_shim(efn: &ExternFn, types: &Types) -> TokenStream {
527527 true => quote_spanned ! ( span=> :: cxx:: private:: RustVec :: from_mut( #var) ) ,
528528 } ,
529529 inner if types. is_considered_improper_ctype ( inner) => {
530- let var = match ty. pinned {
531- false => quote ! ( #var ) ,
532- true => quote_spanned ! ( span=> :: std:: pin:: Pin :: into_inner_unchecked( #var ) ) ,
530+ let unpin = match ty. pinned {
531+ false => quote ! ( ) ,
532+ true => quote_spanned ! ( span=> :: std:: pin:: Pin :: into_inner_unchecked) ,
533533 } ;
534- let to_ptr = match ty. mutable {
535- false => {
536- quote_spanned ! ( span=> |var| var as * const #inner as * const :: std:: ffi:: c_void)
537- }
538- true => quote_spanned ! ( span=> |var| var as * mut #inner as * mut :: std:: ffi:: c_void) ,
534+ let raw_mutability = match ty. mutable {
535+ false => quote_spanned ! ( span=> const ) ,
536+ true => quote_spanned ! ( span=> mut ) ,
539537 } ;
538+ let to_ptr = quote_spanned ! ( span=> |var| #unpin( var) as * #raw_mutability #inner as * #raw_mutability :: std:: ffi:: c_void) ;
540539 match ( ty. option , ty. mutable ) {
541540 ( false , _) => quote_spanned ! ( span=> #[ allow( clippy:: redundant_closure_call) ] ( #to_ptr) ( #var) ) ,
542541 ( true , false ) => quote_spanned ! ( span=> #var. map_or( :: std:: ptr:: null( ) , #to_ptr) ) ,
You can’t perform that action at this time.
0 commit comments