Skip to content
Myr

Fail with an understandable message is number of fields for serialization is too many

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Mingun · committed by Mingun · parent fd5b5e9 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:serde_derive/src/ser.rs+7 added-1 removed
287 unmodified lines
288 }289}290291fn serialize_struct(params: &Parameters, fields: &[Field], cattrs: &attr::Container) -> Fragment {292 assert!(fields.len() as u64 <= u64::from(u32::MAX));292 assert!(293 fields.len() as u64 <= u64::from(u32::MAX),294 "too many fields in {}: {}, maximum supported count is {}",295 cattrs.name().serialize_name(),296 fields.len(),297 u32::MAX298 );299300 if cattrs.has_flatten() {301 serialize_struct_as_map(params, fields, cattrs)302 } else {
1063 unmodified lines