@@ -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 ;
@@ -401,7 +401,6 @@ impl RawLua {
401401 return Ok ( VmState :: Continue ) ; // Don't allow recursion
402402 }
403403 let rawlua = ( * extra) . raw_lua ( ) ;
404- let _guard = StateGuard :: new ( rawlua, state) ;
405404 let debug = Debug :: new ( rawlua, ar) ;
406405 hook_cb ( ( * extra) . lua ( ) , debug)
407406 } ) ;
@@ -1105,7 +1104,6 @@ impl RawLua {
11051104 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
11061105 // The lock must be already held as the callback is executed
11071106 let rawlua = ( * extra) . raw_lua ( ) ;
1108- let _guard = StateGuard :: new ( rawlua, state) ;
11091107 match ( * upvalue) . data {
11101108 Some ( ref func) => func ( rawlua, nargs) ,
11111109 None => Err ( Error :: CallbackDestructed ) ,
@@ -1149,12 +1147,10 @@ impl RawLua {
11491147 // Async functions cannot be scoped and therefore destroyed,
11501148 // so the first upvalue is always valid
11511149 let upvalue = get_userdata :: < AsyncCallbackUpvalue > ( state, ffi:: lua_upvalueindex ( 1 ) ) ;
1152- let extra = ( * upvalue) . extra . get ( ) ;
1153- callback_error_ext ( state, extra, |extra, nargs| {
1150+ callback_error_ext ( state, ( * upvalue) . extra . get ( ) , |extra, nargs| {
11541151 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
11551152 // The lock must be already held as the callback is executed
11561153 let rawlua = ( * extra) . raw_lua ( ) ;
1157- let _guard = StateGuard :: new ( rawlua, state) ;
11581154
11591155 let func = & * ( * upvalue) . data ;
11601156 let fut = func ( rawlua, nargs) ;
@@ -1179,7 +1175,6 @@ impl RawLua {
11791175 // Lua ensures that `LUA_MINSTACK` stack spaces are available (after pushing arguments)
11801176 // The lock must be already held as the future is polled
11811177 let rawlua = ( * extra) . raw_lua ( ) ;
1182- let _guard = StateGuard :: new ( rawlua, state) ;
11831178
11841179 let fut = & mut ( * upvalue) . data ;
11851180 let mut ctx = Context :: from_waker ( rawlua. waker ( ) ) ;
0 commit comments