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
use rune_testing::*;fnmain() -> runestick::Result<()>{let function:Function = rune!{Function => r#"fn main() { |a, b| a + b }"#};println!("{}", function.call::<(i64,i64),i64>((1,3))?);println!("{}", function.call::<(i64,i64),i64>((2,6))?);Ok(())}
Would panic with: thread 'main' panicked at 'program to run successfully: VmError { kind: Expected { expected: StaticType(StaticType { name: "Function", hash: Hash(0x45b788b02e7f231c) }), actual: Hash(Hash(0x9aa62663879132fb)) } }', src/main.rs:4:30
Expected behavior: Being able to receive the closure and call it.
(My main usecase for storing closures would be for callbacks, ex: a button being pressed, so somewhat similar to the example)
The text was updated successfully, but these errors were encountered:
This looks like an issue with a recently introduced optimization. Closures which do not capture anything from their environment are treated like function. In this case the value being pushed is being pushed as a type, rather than a function. Fix coming up!
How does one receive a closure as a value? Ex:
Would panic with:
thread 'main' panicked at 'program to run successfully: VmError { kind: Expected { expected: StaticType(StaticType { name: "Function", hash: Hash(0x45b788b02e7f231c) }), actual: Hash(Hash(0x9aa62663879132fb)) } }', src/main.rs:4:30
Expected behavior: Being able to receive the closure and call it.
(My main usecase for storing closures would be for callbacks, ex: a button being pressed, so somewhat similar to the example)
The text was updated successfully, but these errors were encountered: