dropbox / pb-jelly

A protobuf code generation framework for the Rust language developed at Dropbox.
Apache License 2.0
610 stars 25 forks source link

Fix an issue with err_if_default_or_unknown codegen. #75

Closed goffrie closed 3 years ago

goffrie commented 3 years ago

typ was being used before being calculated, so it was reading the type of some random other field.

goffrie commented 3 years ago

I can't run the tests in this repo at all so I can't write a regression test, but I don't think one would be helpful anyway as the bug has a very particular shape that I wouldn't expect to resurface.

nipunn1313 commented 3 years ago

whoa. This does seem important to have a regression test for - or more precisely a .proto file whose generated code illustrates the change in this diff.

For running the tests - check out the .travis.yml to see how it's run in there. There's a section in the README (https://github.com/dropbox/pb-jelly#running-the-pbtest-unit-tests) on how to run the unit tests

The tl;dr is

( cd pb_test_gen ; cargo run ) ; cargo test

What are you running into?

nipunn1313 commented 3 years ago

Excellent find. Will merge it once the tests pass. Finnicky indeed. Good stuff.