Change merge_from() to take impl AsView instead of impl Proxy.

PiperOrigin-RevId: 659601898
pull/17717/head
Protobuf Team Bot 4 months ago committed by Copybara-Service
parent e2525e6b36
commit 2bac0e4ce3
  1. 4
      src/google/protobuf/compiler/rust/message.cc

@ -342,7 +342,7 @@ void MessageMergeFrom(Context& ctx, const Descriptor& msg) {
{"merge_from_thunk", ThunkName(ctx, msg, "merge_from")},
},
R"rs(
pub fn merge_from<'src>(&mut self, src: impl $pb$::Proxy<'src, Proxied = $Msg$>) {
pub fn merge_from(&mut self, src: impl $pb$::AsView<Proxied = $Msg$>) {
// SAFETY: self and src are both valid `$Msg$`s.
unsafe {
$merge_from_thunk$(self.raw_msg(), src.as_view().raw_msg());
@ -353,7 +353,7 @@ void MessageMergeFrom(Context& ctx, const Descriptor& msg) {
case Kernel::kUpb:
ctx.Emit(
R"rs(
pub fn merge_from<'src>(&mut self, src: impl $pb$::Proxy<'src, Proxied = $Msg$>) {
pub fn merge_from(&mut self, src: impl $pb$::AsView<Proxied = $Msg$>) {
// SAFETY: self and src are both valid `$Msg$`s.
unsafe {
assert!(

Loading…
Cancel
Save