Skip to content

Commit

Permalink
Fix @rust.Derive codemod
Browse files Browse the repository at this point in the history
Summary:
The ThriftAnnotationsFBSource codemod is generating invalid `rust.Derive` annotations, such as in D68463066.

The correct field name is `derives`:

https://www.internalfb.com/code/fbsource/[8060f7ec852bb1764739bc03713e7f29740cc5a6]/fbcode/thrift/annotation/rust.thrift?lines=336-338%2C359-360

Reviewed By: jdthomas, zertosh

Differential Revision: D68504860

fbshipit-source-id: fbfb60ff6c08d8f314cd49728b6820102547c158
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Jan 22, 2025
1 parent e384726 commit 59aada9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class structure_annotations {
return fmt::format("\"{}\"", str);
}) |
ranges::views::join(',') | ranges::to<std::string>;
to_add.insert(fmt::format("@rust.Derive{{derive = [{}]}}", derives));
to_add.insert(fmt::format("@rust.Derive{{derives = [{}]}}", derives));
fm_.add_include("thrift/annotation/rust.thrift");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def test_rust(self):
@rust.Arc
@rust.Copy
@rust.Derive{derive = ["Foo","Bar"]}
@rust.Derive{derives = ["Foo","Bar"]}
@rust.Exhaustive
@rust.Mod{name = "foo"}
@rust.Ord
Expand Down

0 comments on commit 59aada9

Please sign in to comment.