diff options
author | kyren <kerriganw@gmail.com> | 2018-03-08 12:36:03 -0500 |
---|---|---|
committer | kyren <kerriganw@gmail.com> | 2018-03-08 12:36:03 -0500 |
commit | 431f84012a59582c299bbbd6adf41ff252f78357 (patch) | |
tree | 5e898694389b23864276653d2f5a0c41e815e0b3 /src | |
parent | d06890afc6cf251042a9b2a3e0db0988f25d4f9d (diff) | |
download | mlua-431f84012a59582c299bbbd6adf41ff252f78357.zip |
Enable stack leak panic universally
This will potentially panic on Drop of a `Lua` instance, which may be an abort
if this is a double panic, but that is more desirable than such a bug being
hidden.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.rs | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -52,12 +52,8 @@ impl Drop for Lua { fn drop(&mut self) { unsafe { if !self.ephemeral { - if cfg!(test) { - let top = ffi::lua_gettop(self.state); - if top != 0 { - rlua_abort!("Lua stack leak detected, stack top is {}", top); - } - } + let top = ffi::lua_gettop(self.state); + rlua_assert!(top == 0, "stack leak detected, stack top is {}", top); let extra_data = *(ffi::lua_getextraspace(self.state) as *mut *mut ExtraData); *(*extra_data).registry_unref_list.lock().unwrap() = None; |