@@ -12,7 +12,7 @@ use crate::chunk::ChunkMode;
1212use crate :: error:: { Error , Result } ;
1313use crate :: function:: Function ;
1414use crate :: memory:: { MemoryState , ALLOCATOR } ;
15- use crate :: state:: util:: { callback_error_ext, ref_stack_pop, StateGuard } ;
15+ use crate :: state:: util:: { callback_error_ext, ref_stack_pop} ;
1616use crate :: stdlib:: StdLib ;
1717use crate :: string:: String ;
1818use crate :: table:: Table ;
@@ -436,7 +436,6 @@ impl RawLua {
436436 match ( * extra) . hook_callback . clone ( ) {
437437 Some ( hook_callback) => {
438438 let rawlua = ( * extra) . raw_lua ( ) ;
439- let _guard = StateGuard :: new ( rawlua, state) ;
440439 let debug = Debug :: new ( rawlua, ar) ;
441440 hook_callback ( ( * extra) . lua ( ) , debug)
442441 }
@@ -467,7 +466,6 @@ impl RawLua {
467466
468467 let status = callback_error_ext ( state, ptr:: null_mut ( ) , false , |extra, _| {
469468 let rawlua = ( * extra) . raw_lua ( ) ;
470- let _guard = StateGuard :: new ( rawlua, state) ;
471469 let debug = Debug :: new ( rawlua, ar) ;
472470 let hook_callback = ( * hook_callback_ptr) . clone ( ) ;
473471 hook_callback ( ( * extra) . lua ( ) , debug)
@@ -1197,7 +1195,6 @@ impl RawLua {
11971195 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
11981196 // The lock must be already held as the callback is executed
11991197 let rawlua = ( * extra) . raw_lua ( ) ;
1200- let _guard = StateGuard :: new ( rawlua, state) ;
12011198 match ( * upvalue) . data {
12021199 Some ( ref func) => func ( rawlua, nargs) ,
12031200 None => Err ( Error :: CallbackDestructed ) ,
@@ -1241,12 +1238,10 @@ impl RawLua {
12411238 // Async functions cannot be scoped and therefore destroyed,
12421239 // so the first upvalue is always valid
12431240 let upvalue = get_userdata :: < AsyncCallbackUpvalue > ( state, ffi:: lua_upvalueindex ( 1 ) ) ;
1244- let extra = ( * upvalue) . extra . get ( ) ;
1245- callback_error_ext ( state, extra, true , |extra, nargs| {
1241+ callback_error_ext ( state, ( * upvalue) . extra . get ( ) , true , |extra, nargs| {
12461242 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
12471243 // The lock must be already held as the callback is executed
12481244 let rawlua = ( * extra) . raw_lua ( ) ;
1249- let _guard = StateGuard :: new ( rawlua, state) ;
12501245
12511246 let func = & * ( * upvalue) . data ;
12521247 let fut = func ( rawlua, nargs) ;
@@ -1271,7 +1266,6 @@ impl RawLua {
12711266 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
12721267 // The lock must be already held as the future is polled
12731268 let rawlua = ( * extra) . raw_lua ( ) ;
1274- let _guard = StateGuard :: new ( rawlua, state) ;
12751269
12761270 let fut = & mut ( * upvalue) . data ;
12771271 let mut ctx = Context :: from_waker ( rawlua. waker ( ) ) ;
0 commit comments