From d756ff76ae5c8503bda24fed19fb8b9bb23a3278 Mon Sep 17 00:00:00 2001 From: devillove084 <786537003@qq.com> Date: Mon, 25 Nov 2024 16:39:06 +0000 Subject: [PATCH] feat: update deps --- Cargo.lock | 41 ++++++++---------------------------- cxx-async/Cargo.toml | 1 - cxx-async/src/lib.rs | 3 --- examples/cppcoro/Cargo.toml | 2 +- examples/cppcoro/build.rs | 1 + examples/cppcoro/src/main.rs | 1 + examples/folly/Cargo.toml | 2 +- examples/folly/src/main.rs | 1 + macro/Cargo.toml | 2 +- macro/src/lib.rs | 10 +++++---- 10 files changed, 21 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06bb877..70b335d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,17 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "async-recursion" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "async-recursion" version = "1.1.1" @@ -21,7 +10,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn", ] [[package]] @@ -65,14 +54,13 @@ dependencies = [ name = "cxx-async" version = "0.1.2" dependencies = [ - "async-recursion 1.1.1", + "async-recursion", "cxx", "cxx-async-macro", "cxx-build", "futures", "link-cplusplus", "once_cell", - "pin-utils", "pkg-config", ] @@ -80,7 +68,7 @@ dependencies = [ name = "cxx-async-example-cppcoro" version = "0.1.0" dependencies = [ - "async-recursion 0.3.2", + "async-recursion", "cxx", "cxx-async", "cxx-build", @@ -93,7 +81,7 @@ dependencies = [ name = "cxx-async-example-folly" version = "0.1.0" dependencies = [ - "async-recursion 0.3.2", + "async-recursion", "cxx", "cxx-async", "cxx-build", @@ -108,7 +96,7 @@ version = "0.1.2" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -123,7 +111,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.82", + "syn", ] [[package]] @@ -140,7 +128,7 @@ checksum = "a1719100f31492cd6adeeab9a0f46cdbc846e615fdb66d7b398aa46ec7fdd06f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn", ] [[package]] @@ -211,7 +199,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn", ] [[package]] @@ -344,17 +332,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.82" @@ -392,7 +369,7 @@ checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn", ] [[package]] diff --git a/cxx-async/Cargo.toml b/cxx-async/Cargo.toml index 01baaa5..4f1e697 100644 --- a/cxx-async/Cargo.toml +++ b/cxx-async/Cargo.toml @@ -18,7 +18,6 @@ crate-type = ["lib"] [dependencies] async-recursion = "1" once_cell = "1" -pin-utils = "0.1" # CXX related dependencies cxx = { version = "1", features = ["c++20"] } diff --git a/cxx-async/src/lib.rs b/cxx-async/src/lib.rs index 374d200..b9bb573 100644 --- a/cxx-async/src/lib.rs +++ b/cxx-async/src/lib.rs @@ -188,9 +188,6 @@ const SEND_RESULT_FINISHED: u32 = 2; pub use cxx_async_macro::bridge; -#[doc(hidden)] -pub use pin_utils::unsafe_pinned; - // Replacements for macros that panic that are guaranteed to cause an abort, so that we don't unwind // across C++ frames. diff --git a/examples/cppcoro/Cargo.toml b/examples/cppcoro/Cargo.toml index 5ddc844..8bc4665 100644 --- a/examples/cppcoro/Cargo.toml +++ b/examples/cppcoro/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Patrick Walton "] edition = "2018" [dependencies] -async-recursion = "0.3" +async-recursion = "1" once_cell = "1" # CXX related dependencies diff --git a/examples/cppcoro/build.rs b/examples/cppcoro/build.rs index 6028b4c..ce4b24f 100644 --- a/examples/cppcoro/build.rs +++ b/examples/cppcoro/build.rs @@ -11,6 +11,7 @@ fn main() { cxx_build::bridge("src/main.rs") .file("src/cppcoro_example.cpp") + .flag("-std=c++20") .flag_if_supported("-Wall") .include("include") .include("../common/include") diff --git a/examples/cppcoro/src/main.rs b/examples/cppcoro/src/main.rs index d8a8505..0549252 100644 --- a/examples/cppcoro/src/main.rs +++ b/examples/cppcoro/src/main.rs @@ -12,6 +12,7 @@ use futures::{StreamExt, TryStreamExt}; use once_cell::sync::Lazy; use std::future::Future; use std::ops::Range; +use std::pin::Pin; #[cxx::bridge] mod ffi { diff --git a/examples/folly/Cargo.toml b/examples/folly/Cargo.toml index 951c588..d14c4bf 100644 --- a/examples/folly/Cargo.toml +++ b/examples/folly/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Patrick Walton "] edition = "2018" [dependencies] -async-recursion = "0.3" +async-recursion = "1" once_cell = "1" # CXX related dependencies diff --git a/examples/folly/src/main.rs b/examples/folly/src/main.rs index bfa7f3c..c90d657 100644 --- a/examples/folly/src/main.rs +++ b/examples/folly/src/main.rs @@ -12,6 +12,7 @@ use futures::{StreamExt, TryStreamExt}; use once_cell::sync::Lazy; use std::future::Future; use std::ops::Range; +use std::pin::Pin; #[cxx::bridge] mod ffi { diff --git a/macro/Cargo.toml b/macro/Cargo.toml index c760696..8d1263c 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -14,4 +14,4 @@ proc-macro = true [dependencies] proc-macro2 = "1" quote = "1" -syn = { version = "1", features = ["full"] } +syn = { version = "2" } diff --git a/macro/src/lib.rs b/macro/src/lib.rs index f71dac7..819c0b7 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -120,8 +120,9 @@ fn bridge_future(pieces: AstPieces) -> TokenStream { // method. // 3. The struct isn't `repr(packed)`. We define the struct and don't have this // attribute. - ::cxx_async::unsafe_pinned!(future: ::cxx_async::private::BoxFuture<'static, - ::cxx_async::CxxAsyncResult<#output>>); + fn future(self: Pin<&mut Self>) -> Pin<&mut ::cxx_async::private::BoxFuture<'static, ::cxx_async::CxxAsyncResult<#output>>> { + unsafe { self.map_unchecked_mut(|s| &mut s.future) } + } #[doc(hidden)] fn assert_field_is_unpin() { @@ -272,8 +273,9 @@ fn bridge_stream(pieces: AstPieces) -> TokenStream { // method. // 3. The struct isn't `repr(packed)`. We define the struct and don't have this // attribute. - ::cxx_async::unsafe_pinned!(stream: ::cxx_async::private::BoxStream<'static, - ::cxx_async::CxxAsyncResult<#item>>); + fn stream(self: Pin<&mut Self>) -> Pin<&mut ::cxx_async::private::BoxStream<'static, ::cxx_async::CxxAsyncResult<#item>>> { + unsafe { self.map_unchecked_mut(|s| &mut s.stream) } + } #[doc(hidden)] fn assert_field_is_unpin() {