diff --git a/src/google/protobuf/compiler/rust/accessors/map.cc b/src/google/protobuf/compiler/rust/accessors/map.cc index 633e21cfda6a1..4061d731cacf7 100644 --- a/src/google/protobuf/compiler/rust/accessors/map.cc +++ b/src/google/protobuf/compiler/rust/accessors/map.cc @@ -24,8 +24,8 @@ void Map::InMsgImpl(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"field", field.name()}, {"Key", PrimitiveRsTypeName(key_type)}, {"Value", PrimitiveRsTypeName(value_type)}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"getter", [&] { if (ctx.is_upb()) { @@ -97,8 +97,8 @@ void Map::InMsgImpl(Context& ctx, const FieldDescriptor& field) const { void Map::InExternC(Context& ctx, const FieldDescriptor& field) const { ctx.Emit( { - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"getter", [&] { if (ctx.is_upb()) { @@ -129,8 +129,8 @@ void Map::InThunkCc(Context& ctx, const FieldDescriptor& field) const { {"Value", cpp::PrimitiveTypeName(field.message_type()->map_value()->cpp_type())}, {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"impls", [&] { ctx.Emit( diff --git a/src/google/protobuf/compiler/rust/accessors/repeated_scalar.cc b/src/google/protobuf/compiler/rust/accessors/repeated_scalar.cc index 9b26784384278..b88fa9fe37731 100644 --- a/src/google/protobuf/compiler/rust/accessors/repeated_scalar.cc +++ b/src/google/protobuf/compiler/rust/accessors/repeated_scalar.cc @@ -21,8 +21,8 @@ void RepeatedScalar::InMsgImpl(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"field", field.name()}, {"Scalar", PrimitiveRsTypeName(field)}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"getter", [&] { if (ctx.is_upb()) { @@ -54,7 +54,7 @@ void RepeatedScalar::InMsgImpl(Context& ctx, )rs"); } }}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"field_mutator_getter", [&] { if (ctx.is_upb()) { @@ -101,8 +101,8 @@ void RepeatedScalar::InMsgImpl(Context& ctx, void RepeatedScalar::InExternC(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"Scalar", PrimitiveRsTypeName(field)}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"getter", [&] { if (ctx.is_upb()) { @@ -125,7 +125,7 @@ void RepeatedScalar::InExternC(Context& ctx, )rs"); } }}, - {"clearer_thunk", Thunk(ctx, field, "clear")}}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}}, R"rs( fn $clearer_thunk$(raw_msg: $pbi$::RawMessage); $getter$ @@ -137,9 +137,9 @@ void RepeatedScalar::InThunkCc(Context& ctx, ctx.Emit({{"field", cpp::FieldName(&field)}, {"Scalar", cpp::PrimitiveTypeName(field.cpp_type())}, {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"impls", [&] { ctx.Emit( diff --git a/src/google/protobuf/compiler/rust/accessors/singular_message.cc b/src/google/protobuf/compiler/rust/accessors/singular_message.cc index ca5dce246ae7d..b94473cb6d77a 100644 --- a/src/google/protobuf/compiler/rust/accessors/singular_message.cc +++ b/src/google/protobuf/compiler/rust/accessors/singular_message.cc @@ -26,9 +26,9 @@ void SingularMessage::InMsgImpl(Context& ctx, { {"prefix", prefix}, {"field", field.name()}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, { "view_body", [&] { @@ -91,9 +91,9 @@ void SingularMessage::InExternC(Context& ctx, const FieldDescriptor& field) const { ctx.Emit( { - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"getter_mut", [&] { if (ctx.is_cpp()) { @@ -130,9 +130,9 @@ void SingularMessage::InExternC(Context& ctx, void SingularMessage::InThunkCc(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"getter_mut_thunk", Thunk(ctx, field, "get_mut")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"field", cpp::FieldName(&field)}}, R"cc( const void* $getter_thunk$($QualifiedMsg$* msg) { diff --git a/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc b/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc index 5e520242e409f..a49cf6cbc2596 100644 --- a/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc +++ b/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc @@ -24,7 +24,7 @@ void SingularScalar::InMsgImpl(Context& ctx, { {"field", field.name()}, {"Scalar", PrimitiveRsTypeName(field)}, - {"hazzer_thunk", Thunk(ctx, field, "has")}, + {"hazzer_thunk", ThunkName(ctx, field, "has")}, {"default_value", DefaultValue(field)}, {"getter", [&] { @@ -48,9 +48,9 @@ void SingularScalar::InMsgImpl(Context& ctx, } )rs"); }}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"setter_thunk", Thunk(ctx, field, "set")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"setter_thunk", ThunkName(ctx, field, "set")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"field_mutator_getter", [&] { if (field.has_presence()) { @@ -118,10 +118,10 @@ void SingularScalar::InMsgImpl(Context& ctx, void SingularScalar::InExternC(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"Scalar", PrimitiveRsTypeName(field)}, - {"hazzer_thunk", Thunk(ctx, field, "has")}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"setter_thunk", Thunk(ctx, field, "set")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"hazzer_thunk", ThunkName(ctx, field, "has")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"setter_thunk", ThunkName(ctx, field, "set")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"with_presence_fields_thunks", [&] { if (field.has_presence()) { @@ -144,10 +144,10 @@ void SingularScalar::InThunkCc(Context& ctx, ctx.Emit({{"field", cpp::FieldName(&field)}, {"Scalar", cpp::PrimitiveTypeName(field.cpp_type())}, {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"hazzer_thunk", Thunk(ctx, field, "has")}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"setter_thunk", Thunk(ctx, field, "set")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"hazzer_thunk", ThunkName(ctx, field, "has")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"setter_thunk", ThunkName(ctx, field, "set")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"with_presence_fields_thunks", [&] { if (field.has_presence()) { diff --git a/src/google/protobuf/compiler/rust/accessors/singular_string.cc b/src/google/protobuf/compiler/rust/accessors/singular_string.cc index b89c8bf43a892..227c11b34b266 100644 --- a/src/google/protobuf/compiler/rust/accessors/singular_string.cc +++ b/src/google/protobuf/compiler/rust/accessors/singular_string.cc @@ -22,9 +22,9 @@ namespace rust { void SingularString::InMsgImpl(Context& ctx, const FieldDescriptor& field) const { - std::string hazzer_thunk = Thunk(ctx, field, "has"); - std::string getter_thunk = Thunk(ctx, field, "get"); - std::string setter_thunk = Thunk(ctx, field, "set"); + std::string hazzer_thunk = ThunkName(ctx, field, "has"); + std::string getter_thunk = ThunkName(ctx, field, "get"); + std::string setter_thunk = ThunkName(ctx, field, "set"); std::string proxied_type = PrimitiveRsTypeName(field); auto transform_view = [&] { if (field.type() == FieldDescriptor::TYPE_STRING) { @@ -85,7 +85,7 @@ void SingularString::InMsgImpl(Context& ctx, {"hazzer_thunk", hazzer_thunk}, {"getter_thunk", getter_thunk}, {"setter_thunk", setter_thunk}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, }, R"rs( pub fn $field$_mut(&mut self) -> $pb$::FieldEntry<'_, $proxied_type$> { @@ -153,10 +153,10 @@ void SingularString::InMsgImpl(Context& ctx, void SingularString::InExternC(Context& ctx, const FieldDescriptor& field) const { - ctx.Emit({{"hazzer_thunk", Thunk(ctx, field, "has")}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"setter_thunk", Thunk(ctx, field, "set")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + ctx.Emit({{"hazzer_thunk", ThunkName(ctx, field, "has")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"setter_thunk", ThunkName(ctx, field, "set")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"with_presence_fields_thunks", [&] { if (field.has_presence()) { @@ -177,10 +177,10 @@ void SingularString::InThunkCc(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({{"field", cpp::FieldName(&field)}, {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"hazzer_thunk", Thunk(ctx, field, "has")}, - {"getter_thunk", Thunk(ctx, field, "get")}, - {"setter_thunk", Thunk(ctx, field, "set")}, - {"clearer_thunk", Thunk(ctx, field, "clear")}, + {"hazzer_thunk", ThunkName(ctx, field, "has")}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"setter_thunk", ThunkName(ctx, field, "set")}, + {"clearer_thunk", ThunkName(ctx, field, "clear")}, {"with_presence_fields_thunks", [&] { if (field.has_presence()) { diff --git a/src/google/protobuf/compiler/rust/message.cc b/src/google/protobuf/compiler/rust/message.cc index 408678367cc5b..5247acfce24dc 100644 --- a/src/google/protobuf/compiler/rust/message.cc +++ b/src/google/protobuf/compiler/rust/message.cc @@ -29,13 +29,13 @@ namespace { void MessageNew(Context& ctx, const Descriptor& msg) { switch (ctx.opts().kernel) { case Kernel::kCpp: - ctx.Emit({{"new_thunk", Thunk(ctx, msg, "new")}}, R"rs( + ctx.Emit({{"new_thunk", ThunkName(ctx, msg, "new")}}, R"rs( Self { inner: $pbr$::MessageInner { msg: unsafe { $new_thunk$() } } } )rs"); return; case Kernel::kUpb: - ctx.Emit({{"new_thunk", Thunk(ctx, msg, "new")}}, R"rs( + ctx.Emit({{"new_thunk", ThunkName(ctx, msg, "new")}}, R"rs( let arena = $pbr$::Arena::new(); Self { inner: $pbr$::MessageInner { @@ -53,13 +53,13 @@ void MessageNew(Context& ctx, const Descriptor& msg) { void MessageSerialize(Context& ctx, const Descriptor& msg) { switch (ctx.opts().kernel) { case Kernel::kCpp: - ctx.Emit({{"serialize_thunk", Thunk(ctx, msg, "serialize")}}, R"rs( + ctx.Emit({{"serialize_thunk", ThunkName(ctx, msg, "serialize")}}, R"rs( unsafe { $serialize_thunk$(self.inner.msg) } )rs"); return; case Kernel::kUpb: - ctx.Emit({{"serialize_thunk", Thunk(ctx, msg, "serialize")}}, R"rs( + ctx.Emit({{"serialize_thunk", ThunkName(ctx, msg, "serialize")}}, R"rs( let arena = $pbr$::Arena::new(); let mut len = 0; unsafe { @@ -78,7 +78,7 @@ void MessageDeserialize(Context& ctx, const Descriptor& msg) { case Kernel::kCpp: ctx.Emit( { - {"deserialize_thunk", Thunk(ctx, msg, "deserialize")}, + {"deserialize_thunk", ThunkName(ctx, msg, "deserialize")}, }, R"rs( let success = unsafe { @@ -94,7 +94,7 @@ void MessageDeserialize(Context& ctx, const Descriptor& msg) { return; case Kernel::kUpb: - ctx.Emit({{"deserialize_thunk", Thunk(ctx, msg, "parse")}}, R"rs( + ctx.Emit({{"deserialize_thunk", ThunkName(ctx, msg, "parse")}}, R"rs( let arena = $pbr$::Arena::new(); let msg = unsafe { $deserialize_thunk$(data.as_ptr(), data.len(), arena.raw()) @@ -122,10 +122,10 @@ void MessageExterns(Context& ctx, const Descriptor& msg) { case Kernel::kCpp: ctx.Emit( { - {"new_thunk", Thunk(ctx, msg, "new")}, - {"delete_thunk", Thunk(ctx, msg, "delete")}, - {"serialize_thunk", Thunk(ctx, msg, "serialize")}, - {"deserialize_thunk", Thunk(ctx, msg, "deserialize")}, + {"new_thunk", ThunkName(ctx, msg, "new")}, + {"delete_thunk", ThunkName(ctx, msg, "delete")}, + {"serialize_thunk", ThunkName(ctx, msg, "serialize")}, + {"deserialize_thunk", ThunkName(ctx, msg, "deserialize")}, }, R"rs( fn $new_thunk$() -> $pbi$::RawMessage; @@ -138,9 +138,9 @@ void MessageExterns(Context& ctx, const Descriptor& msg) { case Kernel::kUpb: ctx.Emit( { - {"new_thunk", Thunk(ctx, msg, "new")}, - {"serialize_thunk", Thunk(ctx, msg, "serialize")}, - {"deserialize_thunk", Thunk(ctx, msg, "parse")}, + {"new_thunk", ThunkName(ctx, msg, "new")}, + {"serialize_thunk", ThunkName(ctx, msg, "serialize")}, + {"deserialize_thunk", ThunkName(ctx, msg, "parse")}, }, R"rs( fn $new_thunk$(arena: $pbi$::RawArena) -> $pbi$::RawMessage; @@ -160,7 +160,7 @@ void MessageDrop(Context& ctx, const Descriptor& msg) { return; } - ctx.Emit({{"delete_thunk", Thunk(ctx, msg, "delete")}}, R"rs( + ctx.Emit({{"delete_thunk", ThunkName(ctx, msg, "delete")}}, R"rs( unsafe { $delete_thunk$(self.inner.msg); } )rs"); } @@ -173,8 +173,8 @@ void GetterForViewOrMut(Context& ctx, const FieldDescriptor& field, bool is_mut) { auto fieldName = field.name(); auto fieldType = field.type(); - auto getter_thunk = Thunk(ctx, field, "get"); - auto setter_thunk = Thunk(ctx, field, "set"); + auto getter_thunk = ThunkName(ctx, field, "get"); + auto setter_thunk = ThunkName(ctx, field, "set"); // If we're dealing with a Mut, the getter must be supplied // self.inner.msg() whereas a View has to be supplied self.msg auto self = is_mut ? "self.inner.msg()" : "self.msg"; @@ -552,10 +552,10 @@ void GenerateThunksCc(Context& ctx, const Descriptor& msg) { {{"abi", "\"C\""}, // Workaround for syntax highlight bug in VSCode. {"Msg", msg.name()}, {"QualifiedMsg", cpp::QualifiedClassName(&msg)}, - {"new_thunk", Thunk(ctx, msg, "new")}, - {"delete_thunk", Thunk(ctx, msg, "delete")}, - {"serialize_thunk", Thunk(ctx, msg, "serialize")}, - {"deserialize_thunk", Thunk(ctx, msg, "deserialize")}, + {"new_thunk", ThunkName(ctx, msg, "new")}, + {"delete_thunk", ThunkName(ctx, msg, "delete")}, + {"serialize_thunk", ThunkName(ctx, msg, "serialize")}, + {"deserialize_thunk", ThunkName(ctx, msg, "deserialize")}, {"nested_msg_thunks", [&] { for (int i = 0; i < msg.nested_type_count(); ++i) { diff --git a/src/google/protobuf/compiler/rust/naming.cc b/src/google/protobuf/compiler/rust/naming.cc index 1167ea7478408..8f6258ec238b0 100644 --- a/src/google/protobuf/compiler/rust/naming.cc +++ b/src/google/protobuf/compiler/rust/naming.cc @@ -77,8 +77,8 @@ std::string FieldPrefix(Context& ctx, const T& field) { } template -std::string Thunk(Context& ctx, const T& field, absl::string_view op) { - std::string thunk = FieldPrefix(ctx, field); +std::string ThunkName(Context& ctx, const T& field, absl::string_view op) { + std::string thunkName = FieldPrefix(ctx, field); absl::string_view format; if (ctx.is_upb() && op == "get") { @@ -95,46 +95,47 @@ std::string Thunk(Context& ctx, const T& field, absl::string_view op) { format = "_$0_$1"; } - absl::SubstituteAndAppend(&thunk, format, op, field.name()); - return thunk; + absl::SubstituteAndAppend(&thunkName, format, op, field.name()); + return thunkName; } std::string ThunkMapOrRepeated(Context& ctx, const FieldDescriptor& field, absl::string_view op) { if (!ctx.is_upb()) { - return Thunk(ctx, field, op); + return ThunkName(ctx, field, op); } - std::string thunk = absl::StrCat("_", FieldPrefix(ctx, field)); + std::string thunkName = absl::StrCat("_", FieldPrefix(ctx, field)); absl::string_view format; if (op == "get") { format = field.is_map() ? "_$1_upb_map" : "_$1_upb_array"; } else if (op == "get_mut") { format = field.is_map() ? "_$1_mutable_upb_map" : "_$1_mutable_upb_array"; } else { - return Thunk(ctx, field, op); + return ThunkName(ctx, field, op); } - absl::SubstituteAndAppend(&thunk, format, op, field.name()); - return thunk; + absl::SubstituteAndAppend(&thunkName, format, op, field.name()); + return thunkName; } } // namespace -std::string Thunk(Context& ctx, const FieldDescriptor& field, - absl::string_view op) { +std::string ThunkName(Context& ctx, const FieldDescriptor& field, + absl::string_view op) { if (field.is_map() || field.is_repeated()) { return ThunkMapOrRepeated(ctx, field, op); } - return Thunk(ctx, field, op); + return ThunkName(ctx, field, op); } -std::string Thunk(Context& ctx, const OneofDescriptor& field, - absl::string_view op) { - return Thunk(ctx, field, op); +std::string ThunkName(Context& ctx, const OneofDescriptor& field, + absl::string_view op) { + return ThunkName(ctx, field, op); } -std::string Thunk(Context& ctx, const Descriptor& msg, absl::string_view op) { +std::string ThunkName(Context& ctx, const Descriptor& msg, + absl::string_view op) { absl::string_view prefix = ctx.is_cpp() ? "__rust_proto_thunk__" : ""; return absl::StrCat(prefix, GetUnderscoreDelimitedFullName(ctx, msg), "_", op); diff --git a/src/google/protobuf/compiler/rust/naming.h b/src/google/protobuf/compiler/rust/naming.h index e6f7b7f970ae9..154e9024c26a1 100644 --- a/src/google/protobuf/compiler/rust/naming.h +++ b/src/google/protobuf/compiler/rust/naming.h @@ -25,12 +25,13 @@ std::string GetRsFile(Context& ctx, const FileDescriptor& file); std::string GetThunkCcFile(Context& ctx, const FileDescriptor& file); std::string GetHeaderFile(Context& ctx, const FileDescriptor& file); -std::string Thunk(Context& ctx, const FieldDescriptor& field, - absl::string_view op); -std::string Thunk(Context& ctx, const OneofDescriptor& field, - absl::string_view op); +std::string ThunkName(Context& ctx, const FieldDescriptor& field, + absl::string_view op); +std::string ThunkName(Context& ctx, const OneofDescriptor& field, + absl::string_view op); -std::string Thunk(Context& ctx, const Descriptor& msg, absl::string_view op); +std::string ThunkName(Context& ctx, const Descriptor& msg, + absl::string_view op); std::string PrimitiveRsTypeName(const FieldDescriptor& field); diff --git a/src/google/protobuf/compiler/rust/oneof.cc b/src/google/protobuf/compiler/rust/oneof.cc index 8d269ae29e612..a2d4ca86e404a 100644 --- a/src/google/protobuf/compiler/rust/oneof.cc +++ b/src/google/protobuf/compiler/rust/oneof.cc @@ -319,7 +319,7 @@ void GenerateOneofAccessors(Context& ctx, const OneofDescriptor& oneof) { )rs"); } }}, - {"case_thunk", Thunk(ctx, oneof, "case")}}, + {"case_thunk", ThunkName(ctx, oneof, "case")}}, R"rs( pub fn r#$oneof_name$(&self) -> $Msg$_::$view_enum_name$ { match unsafe { $case_thunk$(self.inner.msg) } { @@ -342,7 +342,7 @@ void GenerateOneofExternC(Context& ctx, const OneofDescriptor& oneof) { ctx.Emit( { {"case_enum_rs_name", oneofCaseEnumName(oneof)}, - {"case_thunk", Thunk(ctx, oneof, "case")}, + {"case_thunk", ThunkName(ctx, oneof, "case")}, }, R"rs( fn $case_thunk$(raw_msg: $pbi$::RawMessage) -> $Msg$_::$case_enum_rs_name$; @@ -354,7 +354,7 @@ void GenerateOneofThunkCc(Context& ctx, const OneofDescriptor& oneof) { { {"oneof_name", oneof.name()}, {"case_enum_name", oneofCaseEnumName(oneof)}, - {"case_thunk", Thunk(ctx, oneof, "case")}, + {"case_thunk", ThunkName(ctx, oneof, "case")}, {"QualifiedMsg", cpp::QualifiedClassName(oneof.containing_type())}, }, R"cc(