diff --git a/src/google/protobuf/compiler/rust/message.cc b/src/google/protobuf/compiler/rust/message.cc index 318ba2c369..235f8ffc3d 100644 --- a/src/google/protobuf/compiler/rust/message.cc +++ b/src/google/protobuf/compiler/rust/message.cc @@ -285,21 +285,36 @@ void UpbGeneratedMessageTraitImpls(Context& ctx, const Descriptor& msg) { unsafe impl $pbr$::AssociatedMiniTable for $Msg$ { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { - $std$::ptr::addr_of!($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$) + } } } unsafe impl $pbr$::AssociatedMiniTable for $Msg$View<'_> { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { - $std$::ptr::addr_of!($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$) + } } } unsafe impl $pbr$::AssociatedMiniTable for $Msg$Mut<'_> { #[inline(always)] fn mini_table() -> *const $pbr$::upb_MiniTable { - $std$::ptr::addr_of!($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$) + } } } )rs");