You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ cargo +1.64.0 build
Compiling karyon_jsonrpc v0.1.4
error: future cannot be sent between threads safely
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:258:25
|
258 | self.task_group.spawn(
| ^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `dyn Fn(Arc<Channel>, std::string::String, Value) -> Pin<Box<dyn Future<Output = std::result::Result<Value, RPCError>> + Sync + std::marker::Send>> + std::marker::Send`
note: future is not `Send` as this value is used across an await
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:293:80
|
293 | response.result = match method(channel, req.msg.method, params).await {
| ------ ^^^^^^ await occurs here, with `method` maybe used later
| |
| has type `&Box<dyn Fn(Arc<Channel>, std::string::String, Value) -> Pin<Box<dyn Future<Output = std::result::Result<Value, RPCError>> + Sync + std::marker::Send>> + std::marker::Send>` which is not `Send`
...
296 | };
| - `method` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:293:41
|
293 | response.result = match method(channel, req.msg.method, params).await {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TaskGroup::spawn`
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_core-0.1.4/src/async_util/task_group.rs:62:35
|
62 | Fut: Future<Output = T> + Send + 'static,
| ^^^^ required by this bound in `TaskGroup::spawn`
error: future cannot be sent between threads safely
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:258:25
|
258 | self.task_group.spawn(
| ^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `dyn Fn(Value) -> Pin<Box<dyn Future<Output = std::result::Result<Value, RPCError>> + Sync + std::marker::Send>> + std::marker::Send`
note: future is not `Send` as this value is used across an await
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:307:55
|
307 | response.result = match method(params).await {
| ------ ^^^^^^ await occurs here, with `method` maybe used later
| |
| has type `&Box<dyn Fn(Value) -> Pin<Box<dyn Future<Output = std::result::Result<Value, RPCError>> + Sync + std::marker::Send>> + std::marker::Send>` which is not `Send`
...
310 | };
| - `method` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/server/mod.rs:307:41
|
307 | response.result = match method(params).await {
| ^^^^^^^^^^^^^^
note: required by a bound in `TaskGroup::spawn`
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_core-0.1.4/src/async_util/task_group.rs:62:35
|
62 | Fut: Future<Output = T> + Send + 'static,
| ^^^^ required by this bound in `TaskGroup::spawn`
error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/error.rs:62:46
|
62 | Error::ChannelSend(error.to_string().leak())
| ^^^^ method not found in `std::string::String`
error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.4/src/error.rs:89:48
|
89 | RPCError::ParseError(error.to_string().leak())
| ^^^^ method not found in `std::string::String`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `karyon_jsonrpc` due to 4 previous errors
But it works on stable toolchain.
The text was updated successfully, but these errors were encountered:
Hello @weiyuhang2011
Sorry to hear that. I have published a new update that fixes this issue along with other changes and fixes. Please update to the latest version on crates.io, and it should work fine.
I tried to build a simple jsonrpc server using karyon_jsonrpc from https://github.com/karyontech/karyon/blob/master/jsonrpc/examples/pubsub_server.rs with rust 1.64.0. It failed with following errors:
But it works on stable toolchain.
The text was updated successfully, but these errors were encountered: