mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Remove terrible awful no-good evil hack
The breakage is being addressed in rust itself.
This commit is contained in:
@@ -122,7 +122,6 @@ impl<'lua> Function<'lua> {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn bind<A: ToLuaMulti<'lua>>(&self, args: A) -> Result<Function<'lua>> {
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn bind_call_impl(state: *mut ffi::lua_State) -> c_int {
|
||||
let nargs = ffi::lua_gettop(state);
|
||||
let nbinds = ffi::lua_tointeger(state, ffi::lua_upvalueindex(2)) as c_int;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#![cfg_attr(unwind, feature(unwind_attributes))]
|
||||
|
||||
//! # High-level bindings to Lua
|
||||
//!
|
||||
//! The `rlua` crate provides safe high-level bindings to the [Lua programming language].
|
||||
|
||||
@@ -759,7 +759,6 @@ impl Lua {
|
||||
pub(crate) unsafe fn userdata_metatable<T: UserData>(&self) -> Result<c_int> {
|
||||
// Used if both an __index metamethod is set and regular methods, checks methods table
|
||||
// first, then __index metamethod.
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn meta_index_impl(state: *mut ffi::lua_State) -> c_int {
|
||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||
|
||||
@@ -997,7 +996,6 @@ impl Lua {
|
||||
&'lua self,
|
||||
func: Callback<'callback, 'static>,
|
||||
) -> Result<Function<'lua>> {
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn callback_call_impl(state: *mut ffi::lua_State) -> c_int {
|
||||
callback_error(state, || {
|
||||
let lua = Lua {
|
||||
|
||||
@@ -119,7 +119,6 @@ where
|
||||
nresults: c_int,
|
||||
}
|
||||
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn do_call<F, R>(state: *mut ffi::lua_State) -> c_int
|
||||
where
|
||||
F: FnOnce(*mut ffi::lua_State) -> R,
|
||||
@@ -270,7 +269,6 @@ pub unsafe fn take_userdata<T>(state: *mut ffi::lua_State) -> T {
|
||||
ptr::read(ud)
|
||||
}
|
||||
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
pub unsafe extern "C" fn userdata_destructor<T>(state: *mut ffi::lua_State) -> c_int {
|
||||
callback_error(state, || {
|
||||
take_userdata::<T>(state);
|
||||
@@ -308,7 +306,6 @@ where
|
||||
// Takes an error at the top of the stack, and if it is a WrappedError, converts it to an
|
||||
// Error::CallbackError with a traceback, if it is some lua type, prints the error along with a
|
||||
// traceback, and if it is a WrappedPanic, does not modify it.
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
pub unsafe extern "C" fn error_traceback(state: *mut ffi::lua_State) -> c_int {
|
||||
// I believe luaL_traceback requires this much free stack to not error.
|
||||
const LUA_TRACEBACK_STACK: c_int = 11;
|
||||
@@ -355,7 +352,6 @@ pub unsafe extern "C" fn error_traceback(state: *mut ffi::lua_State) -> c_int {
|
||||
}
|
||||
|
||||
// A variant of pcall that does not allow lua to catch panic errors from callback_error
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
pub unsafe extern "C" fn safe_pcall(state: *mut ffi::lua_State) -> c_int {
|
||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||
|
||||
@@ -378,9 +374,7 @@ pub unsafe extern "C" fn safe_pcall(state: *mut ffi::lua_State) -> c_int {
|
||||
}
|
||||
|
||||
// A variant of xpcall that does not allow lua to catch panic errors from callback_error
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
pub unsafe extern "C" fn safe_xpcall(state: *mut ffi::lua_State) -> c_int {
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn xpcall_msgh(state: *mut ffi::lua_State) -> c_int {
|
||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||
|
||||
@@ -480,7 +474,6 @@ pub unsafe fn init_error_metatables(state: *mut ffi::lua_State) {
|
||||
|
||||
// Create error metatable
|
||||
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn error_tostring(state: *mut ffi::lua_State) -> c_int {
|
||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||
|
||||
@@ -544,7 +537,6 @@ pub unsafe fn init_error_metatables(state: *mut ffi::lua_State) {
|
||||
|
||||
// Create destructed userdata metatable
|
||||
|
||||
#[cfg_attr(unwind, unwind)]
|
||||
unsafe extern "C" fn destructed_error(state: *mut ffi::lua_State) -> c_int {
|
||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||
push_wrapped_error(state, Error::CallbackDestructed);
|
||||
|
||||
Reference in New Issue
Block a user