tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.78k stars 494 forks source link

better checking of tag duplicates, avoid discarding invalid variant errs #951

Closed mumbleskates closed 3 months ago

mumbleskates commented 9 months ago

Currently it seems that the "invalid oneof variant" Errs are always discarded because they are being passed directly into flat_map from a closure, rather than actually propagating the error.

This PR also streamlines the checks for duplicated tag numbers and adds some rudimentary tests for the affected code in those proc macros.

mumbleskates commented 3 months ago

incidentally, most (all? probably, all) of my contributions to Prost were discovered/developed while forking and almost completely rewriting it. Downstream of here i have changed the nature of the encoding slightly (not dramatically), but i have also achieved huge strides in usability:

if any of these sound useful to upstream it could be a good project for myself or someone to trace back over my steps in achieving all some of these. some of these can probably be upstreamed in a day or two, others could take longer.

caspermeijn commented 3 months ago

if any of these sound useful to upstream it could be a good project for myself or someone to trace back over my steps in achieving all these. some of these can probably be upstreamed in a day or two, others could take longer.

Improvements are welcome. However, review capacity is low, so bringing in a reviewer would be appreciated.

Keep in mind that prost is focused on an unopinionated implementation of protobuf.