From 59aada922904e389896ce08433213e49f7ecaf02 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 22 Jan 2025 11:35:57 -0800 Subject: [PATCH] Fix @rust.Derive codemod 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 --- .../thrift/src/thrift/compiler/codemod/structure_annotations.cc | 2 +- .../src/thrift/compiler/codemod/structure_annotations_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/third-party/thrift/src/thrift/compiler/codemod/structure_annotations.cc b/third-party/thrift/src/thrift/compiler/codemod/structure_annotations.cc index 4acdec5658819..70b7c7a606905 100644 --- a/third-party/thrift/src/thrift/compiler/codemod/structure_annotations.cc +++ b/third-party/thrift/src/thrift/compiler/codemod/structure_annotations.cc @@ -478,7 +478,7 @@ class structure_annotations { return fmt::format("\"{}\"", str); }) | ranges::views::join(',') | ranges::to; - 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"); } diff --git a/third-party/thrift/src/thrift/compiler/codemod/structure_annotations_test.py b/third-party/thrift/src/thrift/compiler/codemod/structure_annotations_test.py index 8d4a372cfbfb8..b7cbdfcd07d12 100644 --- a/third-party/thrift/src/thrift/compiler/codemod/structure_annotations_test.py +++ b/third-party/thrift/src/thrift/compiler/codemod/structure_annotations_test.py @@ -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