You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When merging messages containing fields of type MessageField, these fields are not merged as expected. Instead, the message field is simply overwritten.
In my own fork I fixed this by replacing the relevant code in protobuf/src/rt/message.rs:
/// Read singular `message` field.
pub fn read_singular_message_into_field<M>(
is: &mut CodedInputStream,
target: &mut MessageField<M>,
) -> crate::Result<()>
where
M: Message,
{
let mut m = M::new();
is.merge_message(&mut m)?;
*target = MessageField::some(m);
Ok(())
}
with
/// Read singular `message` field.
pub fn read_singular_message_into_field<M>(
is: &mut CodedInputStream,
target: &mut MessageField<M>,
) -> crate::Result<()>
where
M: Message,
{
if let Some(target) = target.as_mut() {
is.merge_message(target)?;
} else {
let mut m = M::new();
is.merge_message(&mut m)?;
*target = MessageField::some(m);
}
Ok(())
}
Before opening a PR I wanted to ask if the current behavior is by design, or if this is indeed a deviation from the protobuf specification.
The text was updated successfully, but these errors were encountered:
When merging messages containing fields of type
MessageField
, these fields are not merged as expected. Instead, the message field is simply overwritten.In my own fork I fixed this by replacing the relevant code in
protobuf/src/rt/message.rs
:with
Before opening a PR I wanted to ask if the current behavior is by design, or if this is indeed a deviation from the protobuf specification.
The text was updated successfully, but these errors were encountered: