Skip to content

Commit 1986b68

Browse files
committed
chore: remove send-future
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
1 parent 6a0373e commit 1986b68

6 files changed

Lines changed: 4 additions & 54 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ redis = { version = "1.2", default-features = false }
142142
reqwest = { version = "0.13", default-features = false }
143143
rustls = { version = "0.23", default-features = false }
144144
semver = { version = "1", default-features = false }
145-
send-future = { version = "0.1", default-features = false }
146145
serde = { version = "1", default-features = false }
147146
serde_json = { version = "1", default-features = false }
148147
syn = { version = "2", default-features = false, features = ["printing"] }

crates/transport/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ anyhow = { workspace = true, features = ["std"] }
2020
bytes = { workspace = true }
2121
futures = { workspace = true, features = ["std"] }
2222
pin-project-lite = { workspace = true }
23-
send-future = { workspace = true }
2423
tokio = { workspace = true, features = ["macros", "rt", "time"] }
2524
tokio-stream = { workspace = true }
2625
tokio-util = { workspace = true, features = ["codec", "io"] }

crates/transport/src/invoke.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,6 @@ pub trait Invoke: Send + Sync {
2727
type Incoming: AsyncRead + Index<Self::Incoming> + Send + Sync + Unpin + 'static;
2828

2929
/// Invoke function `func` on instance `instance`
30-
///
31-
/// Note, that compilation of code calling methods on [`Invoke`] implementations within [`Send`] async functions
32-
/// may fail with hard-to-debug errors due to a compiler bug:
33-
/// [https://github.com/rust-lang/rust/issues/96865](https://github.com/rust-lang/rust/issues/96865)
34-
///
35-
/// The following fails to compile with rustc 1.78.0:
36-
///
37-
/// ```compile_fail
38-
/// use core::future::Future;
39-
///
40-
/// fn invoke_send<T>() -> impl Future<Output = anyhow::Result<(T::Outgoing, T::Incoming)>> + Send
41-
/// where
42-
/// T: wrpc_transport::Invoke<Context = ()> + Default,
43-
/// {
44-
/// async { T::default().invoke((), "compiler-bug", "free", "since".into(), [[Some(2024)].as_slice(); 0]).await }
45-
/// }
46-
/// ```
47-
///
48-
/// ```text
49-
/// async { T::default().invoke((), "compiler-bug", "free", "since".into(), [[Some(2024)].as_slice(); 0]).await }
50-
/// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `AsRef` is not general enough
51-
/// |
52-
/// = note: `[&'0 [Option<usize>]; 0]` must implement `AsRef<[&'1 [Option<usize>]]>`, for any two lifetimes `'0` and `'1`...
53-
/// = note: ...but it actually implements `AsRef<[&[Option<usize>]]>`
54-
/// ```
55-
///
56-
/// The fix is to call [`send`](send_future::SendFuture::send) provided by [`send_future::SendFuture`], re-exported by this crate, on the future before awaiting:
57-
/// ```
58-
/// use core::future::Future;
59-
/// use wrpc_transport::SendFuture as _;
60-
///
61-
/// fn invoke_send<T>() -> impl Future<Output = anyhow::Result<(T::Outgoing, T::Incoming)>> + Send
62-
/// where
63-
/// T: wrpc_transport::Invoke<Context = ()> + Default,
64-
/// {
65-
/// async { T::default().invoke((), "compiler-bug", "free", "since".into(), [[Some(2024)].as_slice(); 0]).send().await }
66-
/// }
67-
/// ```
6830
fn invoke<P>(
6931
&self,
7032
cx: Self::Context,
@@ -331,7 +293,6 @@ mod tests {
331293

332294
use bytes::Bytes;
333295
use futures::{Stream, StreamExt as _};
334-
use send_future::SendFuture as _;
335296

336297
use super::*;
337298

@@ -354,7 +315,6 @@ mod tests {
354315
(),
355316
[[None].as_slice()],
356317
)
357-
.send()
358318
.await?;
359319
Ok(r0)
360320
}

crates/transport/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub use frame::{
2424
Accept, Decoder as FrameDecoder, Encoder as FrameEncoder, Frame, FrameRef, Server,
2525
};
2626
pub use invoke::{Invoke, InvokeExt};
27-
pub use send_future::SendFuture;
2827
pub use serve::{Serve, ServeExt};
2928
pub use value::*;
3029

crates/wit-bindgen-rust/src/interface.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ pub fn serve_interface<'a, T: {wrpc_transport}::Serve>(
629629
self.src,
630630
r#"
631631
let wrpc__ = {anyhow}::Context::context(
632-
{wrpc_transport}::SendFuture::send({wrpc_transport}::InvokeExt::invoke_values_blocking(wrpc__, cx__, "{instance}", "{}", ({params}), "#,
632+
{wrpc_transport}::InvokeExt::invoke_values_blocking(wrpc__, cx__, "{instance}", "{}", ({params}), "#,
633633
rpc_func_name(func),
634634
wrpc_transport = self.gen.wrpc_transport_path(),
635635
params = {
@@ -650,7 +650,7 @@ pub fn serve_interface<'a, T: {wrpc_transport}::Serve>(
650650
self.src.push_str(".as_slice(), ");
651651
}
652652
}
653-
self.src.push_str("])).await,\n");
653+
self.src.push_str("]).await,\n");
654654
uwriteln!(
655655
self.src,
656656
r#"
@@ -666,7 +666,7 @@ pub fn serve_interface<'a, T: {wrpc_transport}::Serve>(
666666
self.src,
667667
r#"
668668
let (wrpc__, io__) = {anyhow}::Context::context(
669-
{wrpc_transport}::SendFuture::send({wrpc_transport}::InvokeExt::invoke_values(wrpc__, cx__, "{instance}", "{}", ({params}), "#,
669+
{wrpc_transport}::InvokeExt::invoke_values(wrpc__, cx__, "{instance}", "{}", ({params}), "#,
670670
rpc_func_name(func),
671671
wrpc_transport = self.gen.wrpc_transport_path(),
672672
params = {
@@ -687,7 +687,7 @@ pub fn serve_interface<'a, T: {wrpc_transport}::Serve>(
687687
self.src.push_str(".as_slice(), ");
688688
}
689689
}
690-
self.src.push_str("])).await,\n");
690+
self.src.push_str("]).await,\n");
691691
uwriteln!(
692692
self.src,
693693
r#"

0 commit comments

Comments
 (0)