Skip to content

Commit ce5ff11

Browse files
Inline the generated Rust message Drop implementations
This allows the compiler to potentially optimize away unused message types more effectively, as demonstrated by the size reductions observed when unused messages are added in a test proto file. PiperOrigin-RevId: 853529287
1 parent 733f179 commit ce5ff11

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/google/protobuf/compiler/rust/message.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg, const upb::DefPool& pool) {
741741
//~ We implement drop unconditionally, so that `$Msg$: Drop` regardless
742742
//~ of kernel.
743743
impl $std$::ops::Drop for $Msg$ {
744+
#[inline]
744745
fn drop(&mut self) {
745746
$Msg::drop$
746747
}

0 commit comments

Comments
 (0)