diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2022-04-08 10:45:28 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2022-04-08 10:45:28 +0100 |
commit | 70d287cf9f389f1a8f318ff201dd54b575a9f5b2 (patch) | |
tree | 3faecabccaa64ff7c2616d1522f81a4aa1553cfc /tests | |
parent | d607039a313b77dd6db1e2e3cd0643a09c652f86 (diff) | |
download | mlua-70d287cf9f389f1a8f318ff201dd54b575a9f5b2.zip |
Don't pass Lua handler to interrupt callback (Luau) as it's not safe.
Optimize callback_error_ext to check stack only before allocating a new WrappedFailure.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/luau.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/luau.rs b/tests/luau.rs index 044c883..aba581d 100644 --- a/tests/luau.rs +++ b/tests/luau.rs @@ -150,7 +150,7 @@ fn test_interrupts() -> Result<()> { let interrupts_count = Arc::new(AtomicU64::new(0)); let interrupts_count2 = interrupts_count.clone(); - lua.set_interrupt(move |_lua| { + lua.set_interrupt(move || { interrupts_count2.fetch_add(1, Ordering::Relaxed); Ok(VmState::Continue) }); @@ -172,7 +172,7 @@ fn test_interrupts() -> Result<()> { // let yield_count = Arc::new(AtomicU64::new(0)); let yield_count2 = yield_count.clone(); - lua.set_interrupt(move |_lua| { + lua.set_interrupt(move || { if yield_count2.fetch_add(1, Ordering::Relaxed) == 1 { return Ok(VmState::Yield); } @@ -199,7 +199,7 @@ fn test_interrupts() -> Result<()> { // // Test errors in interrupts // - lua.set_interrupt(|_| Err(Error::RuntimeError("error from interrupt".into()))); + lua.set_interrupt(|| Err(Error::RuntimeError("error from interrupt".into()))); match f.call::<_, ()>(()) { Err(Error::CallbackError { cause, .. }) => match *cause { Error::RuntimeError(ref m) if m == "error from interrupt" => {} |