Cleanup mutable thunk usage in singular_message
PiperOrigin-RevId: 588482350
diff --git a/src/google/protobuf/compiler/rust/accessors/singular_message.cc b/src/google/protobuf/compiler/rust/accessors/singular_message.cc
index 5985c10..210512a 100644
--- a/src/google/protobuf/compiler/rust/accessors/singular_message.cc
+++ b/src/google/protobuf/compiler/rust/accessors/singular_message.cc
@@ -27,7 +27,7 @@
{"prefix", prefix},
{"field", field.desc().name()},
{"getter_thunk", Thunk(field, "get")},
- {"getter_mut_thunk", Thunk(field, "mutable")},
+ {"getter_mut_thunk", Thunk(field, "get_mut")},
{"clearer_thunk", Thunk(field, "clear")},
{
"view_body",
@@ -91,7 +91,7 @@
field.Emit(
{
{"getter_thunk", Thunk(field, "get")},
- {"getter_mut_thunk", Thunk(field, "mutable")},
+ {"getter_mut_thunk", Thunk(field, "get_mut")},
{"clearer_thunk", Thunk(field, "clear")},
{"getter_mut",
[&] {
@@ -130,7 +130,7 @@
field.Emit({{"QualifiedMsg",
cpp::QualifiedClassName(field.desc().containing_type())},
{"getter_thunk", Thunk(field, "get")},
- {"getter_mut_thunk", Thunk(field, "mutable")},
+ {"getter_mut_thunk", Thunk(field, "get_mut")},
{"clearer_thunk", Thunk(field, "clear")},
{"field", cpp::FieldName(&field.desc())}},
R"cc(
diff --git a/src/google/protobuf/compiler/rust/naming.cc b/src/google/protobuf/compiler/rust/naming.cc
index 198fbd1..6685493 100644
--- a/src/google/protobuf/compiler/rust/naming.cc
+++ b/src/google/protobuf/compiler/rust/naming.cc
@@ -84,7 +84,10 @@
if (field.is_upb() && op == "get") {
// upb getter is simply the field name (no "get" in the name).
format = "_$1";
- } else if (field.is_upb() && (op == "case")) {
+ } else if (field.is_upb() && op == "get_mut") {
+ // same as above, with with `mutable` prefix
+ format = "_mutable_$1";
+ } else if (field.is_upb() && op == "case") {
// some upb functions are in the order x_op compared to has/set/clear which
// are in the other order e.g. op_x.
format = "_$1_$0";