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")}, {"merge_from_thunk", ThunkName(ctx, msg, "merge_from")},
}, },
R"rs( 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. // SAFETY: self and src are both valid `$Msg$`s.
unsafe { unsafe {
$merge_from_thunk$(self.raw_msg(), src.as_view().raw_msg()); $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: case Kernel::kUpb:
ctx.Emit( ctx.Emit(
R"rs( 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. // SAFETY: self and src are both valid `$Msg$`s.
unsafe { unsafe {
assert!( assert!(

Loading…
Cancel
Save