Skip to content

Commit

Permalink
Support @rust.Ord structured annotation on unions
Browse files Browse the repository at this point in the history
Summary:
The Rust Thrift templates already correctly handle unions that need an Ord impl; it just turns into a `#[derive(Ord)]` on the generated data structure.

But unless the implementation of the `rust.Ord` annotation declares that it is compatible with unions, the Thrift compiler rejects `rust.Ord` on unions.

```lang=text,counterexample
[ERROR:dataswarm/services/if/operators.thrift:80] `Ord` cannot annotate `UnionOfAny`
```

Reviewed By: zertosh

Differential Revision: D62074164

fbshipit-source-id: a22908d1b54ba1b436aec7667bbceddc0acf712a
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Sep 1, 2024
1 parent 6fdd1e9 commit d7966d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions thrift/annotation/rust.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct Exhaustive {

@scope.Struct
@scope.Typedef
@scope.Union
struct Ord {
// # `rust.Ord`
//
Expand Down

0 comments on commit d7966d7

Please sign in to comment.