atpanic function was not a good idea, it's not sound

It crosses the C api boundary, the only proper way to panic would be to actually
error guard everywhere, aborting is fine.
This commit is contained in:
kyren 2017-06-05 01:05:41 -04:00
parent b3218137e1
commit 9aed99e3e3
2 changed files with 1 additions and 10 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "rlua"
version = "0.4.4"
version = "0.4.5"
authors = ["kyren <catherine@chucklefish.org>"]
description = "High level bindings to Lua 5.3"
repository = "https://github.com/chucklefish/rlua"

View File

@ -659,15 +659,6 @@ impl Lua {
pub fn new() -> Lua {
unsafe {
let state = ffi::luaL_newstate();
unsafe extern "C" fn panic_function(state: *mut ffi::lua_State) -> c_int {
if let Some(s) = ffi::lua_tostring(state, -1).as_ref() {
panic!("rlua - unprotected error in call to Lua API ({})", s)
} else {
panic!("rlua - unprotected error in call to Lua API <unprintable error>")
}
}
ffi::lua_atpanic(state, panic_function);
ffi::luaL_openlibs(state);
stack_guard(state, 0, || {