Fix "cannot move out of *self which is behind a shared reference"

This commit is contained in:
David Tolnay 2023-08-20 21:36:55 -07:00
parent 870925d503
commit 1f8c8ad5a3
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -409,9 +409,9 @@ fn serialize_enum(params: &Parameters, variants: &[Variant], cattrs: &attr::Cont
})
.collect();
if cattrs.non_exhaustive() {
if cattrs.remote().is_some() && cattrs.non_exhaustive() {
arms.push(quote! {
unrecognized => _serde::__private::Err(_serde::ser::Error::custom(_serde::__private::ser::CannotSerializeVariant(unrecognized))),
ref unrecognized => _serde::__private::Err(_serde::ser::Error::custom(_serde::__private::ser::CannotSerializeVariant(unrecognized))),
});
}