Skip to content

Commit 958dd59

Browse files
Remove the public _mut() accessors from string fields.
PiperOrigin-RevId: 615824279
1 parent 7e47fc3 commit 958dd59

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

rust/test/cpp/debug_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use googletest::prelude::*;
55
fn test_debug() {
66
let mut msg = DebugMsg::new();
77
msg.set_id(1);
8-
msg.secret_user_data_mut().set("password");
8+
msg.set_secret_user_data("password");
99

1010
assert_that!(format!("{msg:?}"), contains_substring("id: 1"));
1111
assert_that!(format!("{msg:?}"), not(contains_substring("password")));

src/google/protobuf/compiler/rust/accessors/singular_string.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void SingularString::InMsgImpl(Context& ctx, const FieldDescriptor& field,
135135
}
136136
if (field.has_presence()) {
137137
ctx.Emit(R"rs(
138-
pub fn $raw_field_name$_mut(&mut self) -> $pb$::FieldEntry<'_, $proxied_type$> {
138+
fn $raw_field_name$_mut(&mut self) -> $pb$::FieldEntry<'_, $proxied_type$> {
139139
let out = unsafe {
140140
let has = $hazzer_thunk$(self.raw_msg());
141141
$pbi$::new_vtable_field_entry(
@@ -150,7 +150,7 @@ void SingularString::InMsgImpl(Context& ctx, const FieldDescriptor& field,
150150
)rs");
151151
} else {
152152
ctx.Emit(R"rs(
153-
pub fn $raw_field_name$_mut(&mut self) -> $pb$::Mut<'_, $proxied_type$> {
153+
fn $raw_field_name$_mut(&mut self) -> $pb$::Mut<'_, $proxied_type$> {
154154
unsafe {
155155
<$pb$::Mut<$proxied_type$>>::from_inner(
156156
$pbi$::Private,

0 commit comments

Comments
 (0)