Skip to content

Commit

Permalink
Change @rust.Serde default to true
Browse files Browse the repository at this point in the history
Summary:
For most Rust annotations (`rust.Ord`, `rust.Copy`, `rust.Exhaustive`) the annotation name conveys an opt-in. Opt in to `Ord` impls, `Copy` impls, exhaustive matching, etc.

The `rust.Serde` annotation confusingly did not work like this. `rust.Serde` was treated equivalently to `rust.Serde{enabled = false}`, which is an opt-out for use inside of Thrift targets configured with `thrift_rust_options = "serde"` in TARGETS.

This diff changes `rust.Serde` to mean `rust.Serde{enabled = true}` and leaves `rust.Serde{enabled = false}` for the rare opt-out.

Reviewed By: zertosh

Differential Revision: D69065617

fbshipit-source-id: 439589297f6a97b9d3efd2d59a38f6e45d726d53
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Feb 4, 2025
1 parent 8cac651 commit 4eb440d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thrift/annotation/rust.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ struct Type {
@scope.Enum
@scope.Union
struct Serde {
1: bool enabled;
1: bool enabled = true;
}

// # `rust.Mod`
Expand Down

0 comments on commit 4eb440d

Please sign in to comment.