From aca540fac90f10ea74aa40caa315a83b5b9d5104 Mon Sep 17 00:00:00 2001 From: Zoey Greer Date: Wed, 18 Sep 2024 14:31:20 -0400 Subject: [PATCH] address reveiew comment --- src/google/protobuf/compiler/rust/message.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/google/protobuf/compiler/rust/message.cc b/src/google/protobuf/compiler/rust/message.cc index 55020f9e57..2447344939 100644 --- a/src/google/protobuf/compiler/rust/message.cc +++ b/src/google/protobuf/compiler/rust/message.cc @@ -287,6 +287,9 @@ void UpbGeneratedMessageTraitImpls(Context& ctx, const Descriptor& msg) { unsafe impl $pbr$::AssociatedMiniTable for $Msg$ { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { + // This is unsafe only for Rust 1.80 and below and thus can be dropped + // once our MSRV is 1.81+ + #[allow(unused_unsafe)] unsafe { $std$::ptr::addr_of!($minitable$) } @@ -296,6 +299,9 @@ void UpbGeneratedMessageTraitImpls(Context& ctx, const Descriptor& msg) { unsafe impl $pbr$::AssociatedMiniTable for $Msg$View<'_> { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { + // This is unsafe only for Rust 1.80 and below and thus can be dropped + // once our MSRV is 1.81+ + #[allow(unused_unsafe)] unsafe { $std$::ptr::addr_of!($minitable$) } @@ -305,6 +311,9 @@ void UpbGeneratedMessageTraitImpls(Context& ctx, const Descriptor& msg) { unsafe impl $pbr$::AssociatedMiniTable for $Msg$Mut<'_> { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { + // This is unsafe only for Rust 1.80 and below and thus can be dropped + // once our MSRV is 1.81+ + #[allow(unused_unsafe)] unsafe { $std$::ptr::addr_of!($minitable$) }