diff --git a/src/ffi/lua.rs b/src/ffi/lua.rs index ac0ba33..9244559 100644 --- a/src/ffi/lua.rs +++ b/src/ffi/lua.rs @@ -80,7 +80,7 @@ pub const LUA_ERRERR: c_int = 5; #[cfg(any(feature = "lua53", feature = "lua52"))] pub const LUA_ERRERR: c_int = 6; -/// A raw Lua Lua state associated with a thread. +/// A raw Lua state associated with a thread. pub type lua_State = c_void; // basic types diff --git a/tests/compile/lua_norefunwindsafe.stderr b/tests/compile/lua_norefunwindsafe.stderr index e687ffc..9fba8b9 100644 --- a/tests/compile/lua_norefunwindsafe.stderr +++ b/tests/compile/lua_norefunwindsafe.stderr @@ -14,3 +14,50 @@ error[E0277]: the type `UnsafeCell<()>` may contain interior mutability and a re = note: required because it appears within the type `Lua` = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` = note: required because it appears within the type `[closure@$DIR/tests/compile/lua_norefunwindsafe.rs:7:18: 7:48]` + +error[E0277]: the type `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> $DIR/lua_norefunwindsafe.rs:7:5 + | +7 | catch_unwind(|| lua.create_table().unwrap()); + | ^^^^^^^^^^^^ `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + ::: $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ---------- required by this bound in `catch_unwind` + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `RefCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `alloc::sync::ArcInner FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `PhantomData FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `Arc FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `Option FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `mlua::lua::ExtraData` + = note: required because it appears within the type `*mut mlua::lua::ExtraData` + = note: required because it appears within the type `Lua` + = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` + = note: required because it appears within the type `[closure@$DIR/tests/compile/lua_norefunwindsafe.rs:7:18: 7:48]` + +error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> $DIR/lua_norefunwindsafe.rs:7:5 + | +7 | catch_unwind(|| lua.create_table().unwrap()); + | ^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + ::: $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ---------- required by this bound in `catch_unwind` + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `alloc::sync::ArcInner FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `PhantomData FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `Arc FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `Option FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `mlua::lua::ExtraData` + = note: required because it appears within the type `*mut mlua::lua::ExtraData` + = note: required because it appears within the type `Lua` + = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` + = note: required because it appears within the type `[closure@$DIR/tests/compile/lua_norefunwindsafe.rs:7:18: 7:48]` diff --git a/tests/compile/ref_nounwindsafe.stderr b/tests/compile/ref_nounwindsafe.stderr index b6cf3f4..b961355 100644 --- a/tests/compile/ref_nounwindsafe.stderr +++ b/tests/compile/ref_nounwindsafe.stderr @@ -16,3 +16,54 @@ error[E0277]: the type `UnsafeCell<()>` may contain interior mutability and a re = note: required because it appears within the type `mlua::types::LuaRef<'_>` = note: required because it appears within the type `LuaTable<'_>` = note: required because it appears within the type `[closure@$DIR/tests/compile/ref_nounwindsafe.rs:8:18: 8:54]` + +error[E0277]: the type `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> $DIR/ref_nounwindsafe.rs:8:5 + | +8 | catch_unwind(move || table.set("a", "b").unwrap()); + | ^^^^^^^^^^^^ `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + ::: $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ---------- required by this bound in `catch_unwind` + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `RefCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `alloc::sync::ArcInner FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `PhantomData FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `Arc FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `Option FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `mlua::lua::ExtraData` + = note: required because it appears within the type `*mut mlua::lua::ExtraData` + = note: required because it appears within the type `Lua` + = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` + = note: required because it appears within the type `mlua::types::LuaRef<'_>` + = note: required because it appears within the type `LuaTable<'_>` + = note: required because it appears within the type `[closure@$DIR/tests/compile/ref_nounwindsafe.rs:8:18: 8:54]` + +error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> $DIR/ref_nounwindsafe.rs:8:5 + | +8 | catch_unwind(move || table.set("a", "b").unwrap()); + | ^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | + ::: $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ---------- required by this bound in `catch_unwind` + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `Cell` + = note: required because it appears within the type `RefCell<(dyn for<'r, 's> FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>` + = note: required because it appears within the type `alloc::sync::ArcInner FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `PhantomData FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `Arc FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>` + = note: required because it appears within the type `Option FnMut(&'r Lua, mlua::Debug<'s>) -> Result<(), LuaError> + 'static)>>>` + = note: required because it appears within the type `mlua::lua::ExtraData` + = note: required because it appears within the type `*mut mlua::lua::ExtraData` + = note: required because it appears within the type `Lua` + = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` + = note: required because it appears within the type `mlua::types::LuaRef<'_>` + = note: required because it appears within the type `LuaTable<'_>` + = note: required because it appears within the type `[closure@$DIR/tests/compile/ref_nounwindsafe.rs:8:18: 8:54]` diff --git a/tests/compile/scope_mutable_aliasing.rs b/tests/compile/scope_mutable_aliasing.rs index 6bdf498..4e1dcf9 100644 --- a/tests/compile/scope_mutable_aliasing.rs +++ b/tests/compile/scope_mutable_aliasing.rs @@ -2,7 +2,7 @@ use mlua::{Lua, UserData}; fn main() { struct MyUserData<'a>(&'a mut i32); - impl<'a> UserData for MyUserData<'a> {}; + impl<'a> UserData for MyUserData<'a> {} let mut i = 1; diff --git a/tests/compile/scope_userdata_borrow.rs b/tests/compile/scope_userdata_borrow.rs index 6546633..2465234 100644 --- a/tests/compile/scope_userdata_borrow.rs +++ b/tests/compile/scope_userdata_borrow.rs @@ -3,7 +3,7 @@ use mlua::{Lua, UserData}; fn main() { // Should not allow userdata borrow to outlive lifetime of AnyUserData handle struct MyUserData<'a>(&'a i32); - impl<'a> UserData for MyUserData<'a> {}; + impl<'a> UserData for MyUserData<'a> {} let igood = 1;