Expunge unnecessary commentary from singular_message.cc and message.cc codegen

PiperOrigin-RevId: 597027922
pull/15337/head
Hong Shin 11 months ago committed by Copybara-Service
parent afd94185f7
commit 373192ceff
  1. 12
      src/google/protobuf/compiler/rust/accessors/singular_message.cc
  2. 6
      src/google/protobuf/compiler/rust/message.cc

@ -36,11 +36,11 @@ void SingularMessage::InMsgImpl(Context& ctx,
if (ctx.is_upb()) {
ctx.Emit({}, R"rs(
let submsg = unsafe { $getter_thunk$(self.inner.msg) };
// For upb, getters return null if the field is unset, so we need
// to check for null and return the default instance manually.
// Note that a nullptr received from upb manifests as Option::None
//~ For upb, getters return null if the field is unset, so we need
//~ to check for null and return the default instance manually.
//~ Note that a nullptr received from upb manifests as Option::None
match submsg {
// TODO:(b/304357029)
//~ TODO:(b/304357029)
None => $prefix$View::new($pbi$::Private,
$pbr$::ScratchSpace::zeroed_block($pbi$::Private)),
Some(field) => $prefix$View::new($pbi$::Private, field),
@ -48,8 +48,8 @@ void SingularMessage::InMsgImpl(Context& ctx,
)rs");
} else {
ctx.Emit({}, R"rs(
// For C++ kernel, getters automatically return the
// default_instance if the field is unset.
//~ For C++ kernel, getters automatically return the
//~ default_instance if the field is unset.
let submsg = unsafe { $getter_thunk$(self.inner.msg) };
$prefix$View::new($pbi$::Private, submsg)
)rs");

@ -110,8 +110,8 @@ void MessageDeserialize(Context& ctx, const Descriptor& msg) {
match msg {
None => Err($pb$::ParseError),
Some(msg) => {
// This assignment causes self.arena to be dropped and to deallocate
// any previous message pointed/owned to by self.inner.msg.
//~ This assignment causes self.arena to be dropped and to deallocate
//~ any previous message pointed/owned to by self.inner.msg.
self.inner.arena = arena;
self.inner.msg = msg;
Ok(())
@ -437,7 +437,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg) {
{"settable_impl", [&] { MessageSettableValue(ctx, msg); }}},
R"rs(
#[allow(non_camel_case_types)]
// TODO: Implement support for debug redaction
//~ TODO: Implement support for debug redaction
#[derive(Debug)]
pub struct $Msg$ {
inner: $pbr$::MessageInner

Loading…
Cancel
Save