Move the FieldInfoComment down into AccessorGenerator.

PiperOrigin-RevId: 597835662
pull/15422/head
Protobuf Team Bot 11 months ago committed by Copybara-Service
parent 519284a559
commit e542443b53
  1. 4
      src/google/protobuf/compiler/rust/accessors/accessor_generator.h
  2. 6
      src/google/protobuf/compiler/rust/message.cc

@ -14,6 +14,7 @@
#include "absl/log/absl_check.h"
#include "google/protobuf/compiler/rust/context.h"
#include "google/protobuf/compiler/rust/naming.h"
#include "google/protobuf/descriptor.h"
namespace google {
@ -38,6 +39,9 @@ class AccessorGenerator {
const FieldDescriptor& field);
void GenerateMsgImpl(Context& ctx, const FieldDescriptor& field) const {
ctx.Emit({{"comment", FieldInfoComment(ctx, field)}}, R"rs(
// $comment$
)rs");
InMsgImpl(ctx, field);
}
void GenerateExternC(Context& ctx, const FieldDescriptor& field) const {

@ -363,11 +363,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg) {
{"accessor_fns",
[&] {
for (int i = 0; i < msg.field_count(); ++i) {
auto& field = *msg.field(i);
ctx.Emit({{"comment", FieldInfoComment(ctx, field)}}, R"rs(
// $comment$
)rs");
GenerateAccessorMsgImpl(ctx, field);
GenerateAccessorMsgImpl(ctx, *msg.field(i));
ctx.printer().PrintRaw("\n");
}
}},

Loading…
Cancel
Save