Use a pointer instead of a ref from C++ thunk.

While in practice a C++ ref and ptr will have the same ABI, since C doesn't have refs this gets flagged by -Wreturn-type-c-linkage. Note that this contrasts with the Rust side where C-ABI functions that take a pointer or ref are permitted and guaranteed to have the same ABI.

PiperOrigin-RevId: 676875775
pull/18450/head
Protobuf Team Bot 5 months ago committed by Copybara-Service
parent 20eeda825a
commit 3abdf99eec
  1. 4
      src/google/protobuf/compiler/rust/message.cc

@ -1399,10 +1399,10 @@ void GenerateThunksCc(Context& ctx, const Descriptor& msg) {
size_t $repeated_len_thunk$(google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field) {
return field->size();
}
const $QualifiedMsg$& $repeated_get_thunk$(
const $QualifiedMsg$* $repeated_get_thunk$(
google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field,
size_t index) {
return field->Get(index);
return &field->Get(index);
}
$QualifiedMsg$* $repeated_get_mut_thunk$(
google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field,

Loading…
Cancel
Save