change default enum to zero (with thrift_rust_options gating)
commit3bd77510caf08e58458702bf463848cd26ea7c22
authorJim Hunt <jhunt@meta.com>
Tue, 13 Dec 2022 14:52:03 +0000 (13 06:52 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 13 Dec 2022 14:52:03 +0000 (13 06:52 -0800)
tree7ca8d24516b90639897e921aff3fe127772b7675
parentb5f3428c7c2088f6336077f3cdb7fc6c0f542a77
change default enum to zero (with thrift_rust_options gating)

Summary:
This diff changes the default enum value from i32::MIN to zero so
that rust matches the c++ implementation. The change is gated by:

```
thrift_rust_options = ["default_enum_zero"]
```

... so that we can roll this out more quickly.

Reviewed By: ryanthomasjohnson

Differential Revision: D41832035

fbshipit-source-id: 518738041109245c0fe1aebf56a03897f867ebea
third-party/thrift/src/thrift/compiler/generate/t_mstch_rust_generator.cc
third-party/thrift/src/thrift/compiler/generate/templates/rust/lib/enum.mustache
third-party/thrift/src/thrift/compiler/test/fixtures/rust-default-enum-zero/cmd [new file with mode: 0644]
third-party/thrift/src/thrift/compiler/test/fixtures/rust-default-enum-zero/gen-rust/lib.rs [new file with mode: 0644]
third-party/thrift/src/thrift/compiler/test/fixtures/rust-default-enum-zero/gen-rust/types.rs [new file with mode: 0644]
third-party/thrift/src/thrift/compiler/test/fixtures/rust-default-enum-zero/src/module.thrift [new file with mode: 0644]