summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkyren <kerriganw@gmail.com>2018-03-08 12:36:03 -0500
committerkyren <kerriganw@gmail.com>2018-03-08 12:36:03 -0500
commit431f84012a59582c299bbbd6adf41ff252f78357 (patch)
tree5e898694389b23864276653d2f5a0c41e815e0b3 /src
parentd06890afc6cf251042a9b2a3e0db0988f25d4f9d (diff)
downloadmlua-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.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/lua.rs b/src/lua.rs
index 8b8ec3c..df34f9f 100644
--- a/src/lua.rs
+++ b/src/lua.rs
@@ -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;