@@ -205,12 +205,12 @@ std::string ConverterRefCount::BuildFnAdapter(
205205 } else if (src_pty->isPointerType () && tgt_pty->isPointerType ()) {
206206 if (tgt_pty->isVoidPointerType ()) {
207207 closure += std::format (" a{}.cast::<{}>().unwrap()" , i,
208- GetPointeeRustType (src_pty));
208+ ConvertPointeeType (src_pty));
209209 } else if (src_pty->isVoidPointerType ()) {
210210 closure += std::format (" a{}.to_any()" , i);
211211 } else if (tgt_pty->getPointeeType ()->isCharType ()) {
212212 closure += std::format (" a{}.reinterpret_cast::<{}>()" , i,
213- GetPointeeRustType (src_pty));
213+ ConvertPointeeType (src_pty));
214214 } else if (src_pty->getPointeeType ()->isCharType ()) {
215215 closure += std::format (" a{}.reinterpret_cast::<u8>()" , i);
216216 }
@@ -2158,4 +2158,14 @@ std::string ConverterRefCount::ConvertMappedMethodCall(
21582158 return std::format (" {}.with_mut(|__v: {}| __v{})" , ptr, param_type, body);
21592159}
21602160
2161+ std::string ConverterRefCount::ConvertPointeeType (clang::QualType ptr_type) {
2162+ // Pointee of a pointer to incomplete type is an incomplete type that does
2163+ // not have a translation rule. Hence ToString(ptr_type->getPointeeType()) is
2164+ // not enough
2165+ assert (ptr_type->isPointerType ());
2166+ auto str = ToString (ptr_type);
2167+ Unwrap (str, " Ptr<" , " >" );
2168+ return str;
2169+ }
2170+
21612171} // namespace cpp2rust
0 commit comments