From be49318aa44d3942db3614eb6acf73e70b7946ca Mon Sep 17 00:00:00 2001 From: Pure White Date: Mon, 24 Jun 2024 21:07:55 +0800 Subject: [PATCH] feat: update to rustc-hash 2 --- Cargo.lock | 48 +- pilota-build/Cargo.toml | 4 +- pilota-build/test_data/plugin/serde.rs | 136 +- .../test_data/protobuf/nested_message.rs | 73 +- pilota-build/test_data/protobuf/service.rs | 4 +- pilota-build/test_data/thrift/apache.rs | 21548 ++++++++-------- pilota-build/test_data/thrift/auto_name.rs | 1150 +- pilota-build/test_data/thrift/const_val.rs | 15 +- pilota-build/test_data/thrift/decode_error.rs | 98 +- .../test_data/thrift/default_value.rs | 2 +- pilota-build/test_data/thrift/enum_test.rs | 484 +- pilota-build/test_data/thrift/multi.rs | 770 +- pilota-build/test_data/thrift/normal.rs | 2374 +- pilota-build/test_data/thrift/pilota_name.rs | 616 +- .../test_data/thrift/recursive_type.rs | 164 +- pilota-build/test_data/thrift/union.rs | 204 +- pilota-build/test_data/thrift/void.rs | 26 +- pilota-build/test_data/thrift/wrapper_arc.rs | 426 +- pilota-build/test_data/unknown_fields.rs | 3694 +-- 19 files changed, 15921 insertions(+), 15915 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e7ed0ce4..5117bfe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,7 +66,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -77,7 +77,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -151,9 +151,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" [[package]] name = "cfg-if" @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" @@ -765,7 +765,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -803,7 +803,7 @@ dependencies = [ [[package]] name = "pilota-build" -version = "0.11.11" +version = "0.11.12" dependencies = [ "ahash", "anyhow", @@ -828,12 +828,12 @@ dependencies = [ "quote", "rand", "rayon", - "rustc-hash", + "rustc-hash 2.0.0", "salsa", "scoped-tls", "serde", "serde_yaml", - "syn 2.0.67", + "syn 2.0.68", "tempfile", "tokio", "toml", @@ -899,9 +899,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", @@ -1101,6 +1101,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" version = "0.38.34" @@ -1144,7 +1150,7 @@ dependencies = [ "log", "oorandom", "parking_lot", - "rustc-hash", + "rustc-hash 1.1.0", "salsa-macros", "smallvec", ] @@ -1199,7 +1205,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -1275,9 +1281,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.67" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -1313,7 +1319,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -1400,7 +1406,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] [[package]] @@ -1524,7 +1530,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -1546,7 +1552,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1775,5 +1781,5 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.67", + "syn 2.0.68", ] diff --git a/pilota-build/Cargo.toml b/pilota-build/Cargo.toml index 92388720..90ca840f 100644 --- a/pilota-build/Cargo.toml +++ b/pilota-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pilota-build" -version = "0.11.11" +version = "0.11.12" edition = "2021" description = "Compile thrift and protobuf idl into rust code at compile-time." documentation = "https://docs.rs/pilota-build" @@ -32,7 +32,7 @@ phf = { version = "0.11", features = ["macros"] } proc-macro2 = "1" quote = "1" rayon = "1" -rustc-hash = "1" +rustc-hash = "2" salsa = { version = "0.17.0-pre.2" } scoped-tls = "1" serde = { version = "1", features = ["derive"] } diff --git a/pilota-build/test_data/plugin/serde.rs b/pilota-build/test_data/plugin/serde.rs index dfb24ef9..01a14459 100644 --- a/pilota-build/test_data/plugin/serde.rs +++ b/pilota-build/test_data/plugin/serde.rs @@ -195,6 +195,74 @@ pub mod serde { + __protocol.struct_end_len() } } + #[derive( + PartialOrd, + Hash, + Eq, + Ord, + Debug, + Default, + ::pilota::serde::Serialize, + ::pilota::serde::Deserialize, + )] + #[serde(rename = "BB")] + #[derive(Clone, PartialEq)] + pub struct B(pub i32); + + impl ::std::ops::Deref for B { + type Target = i32; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + + impl From for B { + fn from(v: i32) -> Self { + Self(v) + } + } + + impl ::pilota::thrift::Message for B { + fn encode( + &self, + __protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + __protocol.write_i32(*(&**self))?; + ::std::result::Result::Ok(()) + } + + fn decode( + __protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + ::std::result::Result::Ok(B(__protocol.read_i32()?)) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + __protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + ::std::result::Result::Ok(B(__protocol.read_i32().await?)) + }) + } + + fn size(&self, __protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + __protocol.i32_len(*&**self) + } + } #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] #[derivative(Default)] #[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize)] @@ -289,73 +357,5 @@ pub mod serde { __protocol.i32_len(self.inner()) } } - #[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - )] - #[serde(rename = "BB")] - #[derive(Clone, PartialEq)] - pub struct B(pub i32); - - impl ::std::ops::Deref for B { - type Target = i32; - - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - impl From for B { - fn from(v: i32) -> Self { - Self(v) - } - } - - impl ::pilota::thrift::Message for B { - fn encode( - &self, - __protocol: &mut T, - ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { - #[allow(unused_imports)] - use ::pilota::thrift::TOutputProtocolExt; - __protocol.write_i32(*(&**self))?; - ::std::result::Result::Ok(()) - } - - fn decode( - __protocol: &mut T, - ) -> ::std::result::Result { - #[allow(unused_imports)] - use ::pilota::{thrift::TLengthProtocolExt, Buf}; - ::std::result::Result::Ok(B(__protocol.read_i32()?)) - } - - fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( - __protocol: &'a mut T, - ) -> ::std::pin::Pin< - ::std::boxed::Box< - dyn ::std::future::Future< - Output = ::std::result::Result, - > + Send - + 'a, - >, - > { - ::std::boxed::Box::pin(async move { - ::std::result::Result::Ok(B(__protocol.read_i32().await?)) - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - #[allow(unused_imports)] - use ::pilota::thrift::TLengthProtocolExt; - __protocol.i32_len(*&**self) - } - } } } diff --git a/pilota-build/test_data/protobuf/nested_message.rs b/pilota-build/test_data/protobuf/nested_message.rs index 157d6983..2f18c9cb 100644 --- a/pilota-build/test_data/protobuf/nested_message.rs +++ b/pilota-build/test_data/protobuf/nested_message.rs @@ -84,43 +84,6 @@ pub mod nested_message { } pub mod tt1 { - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq, Copy)] - #[repr(transparent)] - pub struct Label(i32); - - impl Label { - pub const LABEL_OPTIONAL: Self = Self(1); - pub const LABEL_REQUIRED: Self = Self(2); - pub const LABEL_REPEATED: Self = Self(3); - - pub fn inner(&self) -> i32 { - self.0 - } - - pub fn to_string(&self) -> ::std::string::String { - match self { - Self(1) => ::std::string::String::from("LABEL_OPTIONAL"), - Self(2) => ::std::string::String::from("LABEL_REQUIRED"), - Self(3) => ::std::string::String::from("LABEL_REPEATED"), - Self(val) => val.to_string(), - } - } - } - - impl ::std::convert::From for Label { - fn from(value: i32) -> Self { - Self(value) - } - } - - impl ::std::convert::From