Skip to content

Instantly share code, notes, and snippets.

@udoprog
Created September 22, 2020 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udoprog/02d0c4ec916f281f13b12183f01a1334 to your computer and use it in GitHub Desktop.
Save udoprog/02d0c4ec916f281f13b12183f01a1334 to your computer and use it in GitHub Desktop.
Error when using Vm::send_execute wrong
cargo : Compiling rune v0.6.16 (D:\Repo\rune\crates\rune)
At line:1 char:1
+ cargo run --example tokio_spawn 2> out.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( Compiling ru...ne\crates\rune):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<std::string::String>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<std::string::String>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<std::string::String>>`
= note: required because it appears within the type `runestick::Shared<std::string::String>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Bytes>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Bytes>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Bytes>>`
= note: required because it appears within the type `runestick::Shared<runestick::Bytes>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<std::vec::Vec<runestick::Value>>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<std::vec::Vec<runestick::Value>>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<std::vec::Vec<runestick::Value>>>`
= note: required because it appears within the type `runestick::Shared<std::vec::Vec<runestick::Value>>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Tuple>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Tuple>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Tuple>>`
= note: required because it appears within the type `runestick::Shared<runestick::Tuple>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Object>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Object>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Object>>`
= note: required because it appears within the type `runestick::Shared<runestick::Object>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Future>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Future>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Future>>`
= note: required because it appears within the type `runestick::Shared<runestick::Future>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Stream>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Stream>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Stream>>`
= note: required because it appears within the type `runestick::Shared<runestick::Stream>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Generator>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Generator>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Generator>>`
= note: required because it appears within the type `runestick::Shared<runestick::Generator>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::GeneratorState>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::GeneratorState>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::GeneratorState>>`
= note: required because it appears within the type `runestick::Shared<runestick::GeneratorState>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<std::option::Option<runestick::Value>>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<std::option::Option<runestick::Value>>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<std::option::Option<runestick::Value>>>`
= note: required because it appears within the type `runestick::Shared<std::option::Option<runestick::Value>>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<std::result::Result<runestick::Value, runestick::Value>>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<std::result::Result<runestick::Value, runestick::Value>>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<std::result::Result<runestick::Value, runestick::Value>>>`
= note: required because it appears within the type `runestick::Shared<std::result::Result<runestick::Value, runestick::Value>>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedTuple>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedTuple>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedTuple>>`
= note: required because it appears within the type `runestick::Shared<runestick::TypedTuple>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TupleVariant>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TupleVariant>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TupleVariant>>`
= note: required because it appears within the type `runestick::Shared<runestick::TupleVariant>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedObject>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedObject>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::TypedObject>>`
= note: required because it appears within the type `runestick::Shared<runestick::TypedObject>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::ObjectVariant>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::ObjectVariant>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::ObjectVariant>>`
= note: required because it appears within the type `runestick::Shared<runestick::ObjectVariant>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Function>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Function>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::Function>>`
= note: required because it appears within the type `runestick::Shared<runestick::Function>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<runestick::AnyObj>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^ `std::ptr::NonNull<runestick::shared::SharedBox<runestick::AnyObj>>` cannot be sent between threads safely
|
= help: within `(runestick::Value,)`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<runestick::shared::SharedBox<runestick::AnyObj>>`
= note: required because it appears within the type `runestick::Shared<runestick::AnyObj>`
= note: required because it appears within the type `runestick::Value`
= note: required because it appears within the type `(runestick::Value,)`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
--> crates\rune\examples\tokio_spawn.rs:3:27
|
1 | #[tokio::main]
| -------------- this function should return `Result` or `Option` to accept `?`
2 | async fn main() -> runestick::Result<()> {
3 | let (context, unit) = rune::testing::build(
| ___________________________^
4 | | r#"
5 | | async fn main(timeout) {
6 | | time::delay_for(time::Duration::from_secs(timeout)).await
7 | | }
8 | | "#,
9 | | )?;
| |______^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `std::ops::Try` is not implemented for `()`
= note: required by `std::ops::Try::from_error`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
--> crates\rune\examples\tokio_spawn.rs:15:21
|
1 | #[tokio::main]
| -------------- this function should return `Result` or `Option` to accept `?`
...
15 | let execution = vm.clone().send_execute(main, (runestick::Value::Integer(5),))?; // <- here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `std::ops::Try` is not implemented for `()`
= note: required by `std::ops::Try::from_error`
error[E0308]: mismatched types
--> crates\rune\examples\tokio_spawn.rs:1:1
|
1 | #[tokio::main]
| ^^^^^^^^^^^^^^
| |
| expected enum `std::result::Result`, found `()`
| help: try using a variant of the expected enum: `Ok(#[tokio::main])`
2 | async fn main() -> runestick::Result<()> {
| --------------------- expected `std::result::Result<(), anyhow::Error>` because of return type
|
= note: expected enum `std::result::Result<(), anyhow::Error>`
found unit type `()`
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 20 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error
: could not compile `rune`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment