Introduce a required #[borsh(use_discriminant = true|false)]
enum attribute when discriminants are specified
#147
Labels
#[borsh(use_discriminant = true|false)]
enum attribute when discriminants are specified
#147
Context:
Before #138 (#137), borsh did not respect explicit enum discriminant values:
In #138, the default behavior changed and while it was marked as a breaking change by releasing 0.11.0 version, it was flagged that it may silently break someone's code, which is totally valid concern, thus, we decided to use a required
#[borsh(use_discriminant = true|false)]
enum attribute to resolve ambiguity, so after 0.11.1 release, the expected behavior would be that the following code will raise a compilation error:This will generate the code equivalent to the borsh before 0.11.0:
This will generate the code equivalent to the implementation in #138:
In the future, we will default to
true
and make this attribute optional, and eventually deprecate it.The text was updated successfully, but these errors were encountered: