diff --git a/thrift/annotation/rust.thrift b/thrift/annotation/rust.thrift index 986500d6acc..450169baced 100644 --- a/thrift/annotation/rust.thrift +++ b/thrift/annotation/rust.thrift @@ -24,14 +24,15 @@ namespace py.asyncio facebook_thrift_asyncio.annotation.rust namespace go thrift.annotation.rust namespace py thrift.annotation.rust +// This is scope.Definition minus scope.Const @scope.Function @scope.EnumValue @scope.Enum -@scope.Struct +@scope.Structured @scope.Field @scope.Typedef -@scope.Union @scope.Service +@scope.Interaction struct Name { // # `rust.Name` // diff --git a/thrift/compiler/test/fixtures/adapter/out/hack/gen-hack/rust_types.php b/thrift/compiler/test/fixtures/adapter/out/hack/gen-hack/rust_types.php index 68aea78bd79..57eb6a5a540 100644 --- a/thrift/compiler/test/fixtures/adapter/out/hack/gen-hack/rust_types.php +++ b/thrift/compiler/test/fixtures/adapter/out/hack/gen-hack/rust_types.php @@ -95,7 +95,7 @@ public static function getAllStructuredAnnotations()[write_props]: \TStructAnnot shape( ) ), - '\facebook\thrift\annotation\Struct' => \facebook\thrift\annotation\Struct::fromShape( + '\facebook\thrift\annotation\Structured' => \facebook\thrift\annotation\Structured::fromShape( shape( ) ), @@ -107,11 +107,11 @@ public static function getAllStructuredAnnotations()[write_props]: \TStructAnnot shape( ) ), - '\facebook\thrift\annotation\Union' => \facebook\thrift\annotation\Union::fromShape( + '\facebook\thrift\annotation\Service' => \facebook\thrift\annotation\Service::fromShape( shape( ) ), - '\facebook\thrift\annotation\Service' => \facebook\thrift\annotation\Service::fromShape( + '\facebook\thrift\annotation\Interaction' => \facebook\thrift\annotation\Interaction::fromShape( shape( ) ), diff --git a/thrift/compiler/test/fixtures/adapter/out/json/gen-json/rust.json b/thrift/compiler/test/fixtures/adapter/out/json/gen-json/rust.json index 3f1b5c9ef53..9675182a7a8 100644 --- a/thrift/compiler/test/fixtures/adapter/out/json/gen-json/rust.json +++ b/thrift/compiler/test/fixtures/adapter/out/json/gen-json/rust.json @@ -8,7 +8,7 @@ }, "structs" : { "Name" : { - "lineno" : 27, + "lineno" : 28, "is_exception" : false, "is_union" : false, "fields" : { @@ -18,11 +18,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 39, + "line" : 40, "column" : 3 }, "end" : { - "line" : 39, + "line" : 40, "column" : 18 } } @@ -30,17 +30,17 @@ }, "source_range" : { "begin" : { - "line" : 27, + "line" : 28, "column" : 1 }, "end" : { - "line" : 40, + "line" : 41, "column" : 2 } } }, "Copy" : { - "lineno" : 42, + "lineno" : 43, "is_exception" : false, "is_union" : false, "fields" : { @@ -48,17 +48,17 @@ }, "source_range" : { "begin" : { - "line" : 42, + "line" : 43, "column" : 1 }, "end" : { - "line" : 47, + "line" : 48, "column" : 2 } } }, "RequestContext" : { - "lineno" : 49, + "lineno" : 50, "is_exception" : false, "is_union" : false, "fields" : { @@ -66,17 +66,17 @@ }, "source_range" : { "begin" : { - "line" : 49, + "line" : 50, "column" : 1 }, "end" : { - "line" : 56, + "line" : 57, "column" : 2 } } }, "Arc" : { - "lineno" : 58, + "lineno" : 59, "is_exception" : false, "is_union" : false, "fields" : { @@ -84,17 +84,17 @@ }, "source_range" : { "begin" : { - "line" : 58, + "line" : 59, "column" : 1 }, "end" : { - "line" : 63, + "line" : 64, "column" : 2 } } }, "Box" : { - "lineno" : 65, + "lineno" : 66, "is_exception" : false, "is_union" : false, "fields" : { @@ -102,17 +102,17 @@ }, "source_range" : { "begin" : { - "line" : 65, + "line" : 66, "column" : 1 }, "end" : { - "line" : 70, + "line" : 71, "column" : 2 } } }, "Exhaustive" : { - "lineno" : 72, + "lineno" : 73, "is_exception" : false, "is_union" : false, "fields" : { @@ -120,17 +120,17 @@ }, "source_range" : { "begin" : { - "line" : 72, + "line" : 73, "column" : 1 }, "end" : { - "line" : 80, + "line" : 81, "column" : 2 } } }, "Ord" : { - "lineno" : 82, + "lineno" : 83, "is_exception" : false, "is_union" : false, "fields" : { @@ -138,17 +138,17 @@ }, "source_range" : { "begin" : { - "line" : 82, + "line" : 83, "column" : 1 }, "end" : { - "line" : 89, + "line" : 90, "column" : 2 } } }, "NewType" : { - "lineno" : 91, + "lineno" : 92, "is_exception" : false, "is_union" : false, "fields" : { @@ -156,17 +156,17 @@ }, "source_range" : { "begin" : { - "line" : 91, + "line" : 92, "column" : 1 }, "end" : { - "line" : 110, + "line" : 111, "column" : 2 } } }, "Type" : { - "lineno" : 112, + "lineno" : 113, "is_exception" : false, "is_union" : false, "fields" : { @@ -176,11 +176,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 266, + "line" : 267, "column" : 3 }, "end" : { - "line" : 266, + "line" : 267, "column" : 18 } } @@ -188,17 +188,17 @@ }, "source_range" : { "begin" : { - "line" : 112, + "line" : 113, "column" : 1 }, "end" : { - "line" : 267, + "line" : 268, "column" : 2 } } }, "Serde" : { - "lineno" : 273, + "lineno" : 274, "is_exception" : false, "is_union" : false, "fields" : { @@ -208,11 +208,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 275, + "line" : 276, "column" : 3 }, "end" : { - "line" : 275, + "line" : 276, "column" : 19 } } @@ -220,17 +220,17 @@ }, "source_range" : { "begin" : { - "line" : 273, + "line" : 274, "column" : 1 }, "end" : { - "line" : 276, + "line" : 277, "column" : 2 } } }, "Mod" : { - "lineno" : 282, + "lineno" : 283, "is_exception" : false, "is_union" : false, "fields" : { @@ -240,11 +240,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 284, + "line" : 285, "column" : 3 }, "end" : { - "line" : 284, + "line" : 285, "column" : 18 } } @@ -252,17 +252,17 @@ }, "source_range" : { "begin" : { - "line" : 282, + "line" : 283, "column" : 1 }, "end" : { - "line" : 285, + "line" : 286, "column" : 2 } } }, "Adapter" : { - "lineno" : 287, + "lineno" : 288, "is_exception" : false, "is_union" : false, "fields" : { @@ -272,11 +272,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 332, + "line" : 333, "column" : 3 }, "end" : { - "line" : 332, + "line" : 333, "column" : 18 } } @@ -284,17 +284,17 @@ }, "source_range" : { "begin" : { - "line" : 287, + "line" : 288, "column" : 1 }, "end" : { - "line" : 333, + "line" : 334, "column" : 2 } } }, "Derive" : { - "lineno" : 335, + "lineno" : 336, "is_exception" : false, "is_union" : false, "fields" : { @@ -304,11 +304,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 358, + "line" : 359, "column" : 3 }, "end" : { - "line" : 358, + "line" : 359, "column" : 27 } } @@ -316,17 +316,17 @@ }, "source_range" : { "begin" : { - "line" : 335, + "line" : 336, "column" : 1 }, "end" : { - "line" : 359, + "line" : 360, "column" : 2 } } }, "ServiceExn" : { - "lineno" : 361, + "lineno" : 362, "is_exception" : false, "is_union" : false, "fields" : { @@ -336,11 +336,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 412, + "line" : 413, "column" : 3 }, "end" : { - "line" : 412, + "line" : 413, "column" : 37 } } @@ -348,11 +348,11 @@ }, "source_range" : { "begin" : { - "line" : 361, + "line" : 362, "column" : 1 }, "end" : { - "line" : 413, + "line" : 414, "column" : 2 } } diff --git a/thrift/compiler/test/fixtures/hack_service/out/hack_module2_with_patch/gen-hack/rust_types.php b/thrift/compiler/test/fixtures/hack_service/out/hack_module2_with_patch/gen-hack/rust_types.php index ccf2c33e689..328b1e8b546 100644 --- a/thrift/compiler/test/fixtures/hack_service/out/hack_module2_with_patch/gen-hack/rust_types.php +++ b/thrift/compiler/test/fixtures/hack_service/out/hack_module2_with_patch/gen-hack/rust_types.php @@ -92,7 +92,7 @@ public static function getAllStructuredAnnotations()[write_props]: \TStructAnnot shape( ) ), - '\facebook\thrift\annotation\Struct' => \facebook\thrift\annotation\Struct::fromShape( + '\facebook\thrift\annotation\Structured' => \facebook\thrift\annotation\Structured::fromShape( shape( ) ), @@ -104,11 +104,11 @@ public static function getAllStructuredAnnotations()[write_props]: \TStructAnnot shape( ) ), - '\facebook\thrift\annotation\Union' => \facebook\thrift\annotation\Union::fromShape( + '\facebook\thrift\annotation\Service' => \facebook\thrift\annotation\Service::fromShape( shape( ) ), - '\facebook\thrift\annotation\Service' => \facebook\thrift\annotation\Service::fromShape( + '\facebook\thrift\annotation\Interaction' => \facebook\thrift\annotation\Interaction::fromShape( shape( ) ), diff --git a/thrift/compiler/test/fixtures/rust-annotations/out/rust/gen-rust/types.rs b/thrift/compiler/test/fixtures/rust-annotations/out/rust/gen-rust/types.rs index 35b963dabf9..def228a939c 100644 --- a/thrift/compiler/test/fixtures/rust-annotations/out/rust/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/rust-annotations/out/rust/gen-rust/types.rs @@ -2046,6 +2046,10 @@ impl ::fbthrift::metadata::ThriftAnnotations for U10 { return r.take(); } + if let ::std::option::Option::Some(r) = ::get_structured_annotation::() { + return ::std::option::Option::Some(r); + } + ::std::option::Option::None } @@ -2066,6 +2070,10 @@ impl ::fbthrift::metadata::ThriftAnnotations for U10 { let r: &mut ::std::option::Option = r.downcast_mut().unwrap(); return r.take(); } + + if let ::std::option::Option::Some(r) = ::get_structured_annotation::() { + return ::std::option::Option::Some(r); + } }, _ => {} } @@ -2193,6 +2201,10 @@ impl ::fbthrift::metadata::ThriftAnnotations for U11 { return r.take(); } + if let ::std::option::Option::Some(r) = ::get_structured_annotation::() { + return ::std::option::Option::Some(r); + } + if type_id == ::std::any::TypeId::of::() { let mut tmp = ::std::option::Option::Some(rust__types::Ord { ..::std::default::Default::default() @@ -2222,6 +2234,10 @@ impl ::fbthrift::metadata::ThriftAnnotations for U11 { let r: &mut ::std::option::Option = r.downcast_mut().unwrap(); return r.take(); } + + if let ::std::option::Option::Some(r) = ::get_structured_annotation::() { + return ::std::option::Option::Some(r); + } }, 2 => { },