From 6ee7c2a51f172ea1c5cb68249b10e32a3a22ac82 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 27 Feb 2023 18:51:59 +0000 Subject: [PATCH] Support passing `Option<&OpaqueStruct>` to C Luckily the solution is trivial - just treat the conversion for the inner pointer as `ptr_for_ref`, because we ultimately want a pointer on the inside, not on the outside. --- c-bindings-gen/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index b13db9e..85ce3e9 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -2377,7 +2377,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { write!(w, "let mut local_{}{} = ", ident, if (!to_c && needs_ref_map) || (to_c && $container_type == "Option" && contains_slice) {"_base"} else { "" }).unwrap(); if prefix_location == ContainerPrefixLocation::OutsideConv { - var_prefix(w, $args_iter().next().unwrap(), generics, is_ref, ptr_for_ref, true); + var_prefix(w, $args_iter().next().unwrap(), generics, is_ref, true, true); } write!(w, "{}{}", prefix, var).unwrap(); -- 2.39.5