Skip to content

Commit

Permalink
Handle pinned returned reference to improper ctype extern type
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 30, 2021
1 parent 847efb8 commit a42a765
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion macro/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,11 @@ fn expand_cxx_function_shim(efn: &ExternFn, types: &Types) -> TokenStream {
},
inner if types.is_considered_improper_ctype(inner) => {
let mutability = ty.mutability;
quote!(&#mutability *#call.cast())
let deref_mut = quote!(&#mutability *#call.cast());
match ty.pinned {
false => deref_mut,
true => quote!(::std::pin::Pin::new_unchecked(#deref_mut)),
}
}
_ => call,
},
Expand Down

0 comments on commit a42a765

Please sign in to comment.