Do not emit gencode for map fields

They are currently unsupported. Up until now we've been generating gencode
assuming that map fields are standard message fields, and the gencode was
expecting thunks such as _serialize to exist, but they don't.

In some toolchains this becomes a linking problem.

PiperOrigin-RevId: 541572265
pull/13095/head
Marcel Hlopko 1 year ago committed by Copybara-Service
parent 8997b54c32
commit 45676832b4
  1. 8
      src/google/protobuf/compiler/rust/message.cc

@ -219,6 +219,10 @@ MessageGenerator::MessageGenerator(Context<Descriptor> msg) {
}
void MessageGenerator::GenerateRs(Context<Descriptor> msg) {
if (msg.desc().map_key() != nullptr) {
ABSL_LOG(WARNING) << "unsupported map field: " << msg.desc().full_name();
return;
}
msg.Emit(
{
{"Msg", msg.desc().name()},
@ -338,6 +342,10 @@ void MessageGenerator::GenerateRs(Context<Descriptor> msg) {
// Generates code for a particular message in `.pb.thunk.cc`.
void MessageGenerator::GenerateThunksCc(Context<Descriptor> msg) {
ABSL_CHECK(msg.is_cpp());
if (msg.desc().map_key() != nullptr) {
ABSL_LOG(WARNING) << "unsupported map field: " << msg.desc().full_name();
return;
}
msg.Emit(
{

Loading…
Cancel
Save