From fdda0d3724cd4b89adebbd699f93306b82a38ae0 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Thu, 27 Apr 2023 23:06:38 +0100 Subject: [PATCH] Update compile tests --- tests/compile/lua_norefunwindsafe.stderr | 46 ++++++++++++--------- tests/compile/non_send.stderr | 45 ++++++++++---------- tests/compile/ref_nounwindsafe.stderr | 50 +++++++++++++---------- tests/compile/static_callback_args.stderr | 28 +++++++------ 4 files changed, 92 insertions(+), 77 deletions(-) diff --git a/tests/compile/lua_norefunwindsafe.stderr b/tests/compile/lua_norefunwindsafe.stderr index ca1ad84..a442d0b 100644 --- a/tests/compile/lua_norefunwindsafe.stderr +++ b/tests/compile/lua_norefunwindsafe.stderr @@ -1,22 +1,28 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> tests/compile/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 - | - = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` - = note: required because it appears within the type `alloc::sync::ArcInner>` - = note: required because it appears within the type `PhantomData>>` - = note: required because it appears within the type `Arc>` - = note: required because it appears within the type `Lua` - = note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` +error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> tests/compile/lua_norefunwindsafe.rs:7:18 + | +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 + | | + | required by a bound introduced by this call + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `ArcInner>` + = note: required because it appears within the type `PhantomData>>` + = note: required because it appears within the type `Arc>` + = note: required because it appears within the type `LuaInner` + = note: required because it appears within the type `ArcInner` + = note: required because it appears within the type `PhantomData>` + = note: required because it appears within the type `Arc` + = note: required because it appears within the type `Lua` + = note: required for `&Lua` to implement `UnwindSafe` note: required because it's used within this closure - --> tests/compile/lua_norefunwindsafe.rs:7:18 - | -7 | catch_unwind(|| lua.create_table().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> tests/compile/lua_norefunwindsafe.rs:7:18 + | +7 | catch_unwind(|| lua.create_table().unwrap()); + | ^^ note: required by a bound in `catch_unwind` - --> $RUST/std/src/panic.rs - | - | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { - | ^^^^^^^^^^ required by this bound in `catch_unwind` + --> $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ^^^^^^^^^^ required by this bound in `catch_unwind` diff --git a/tests/compile/non_send.stderr b/tests/compile/non_send.stderr index 394b1ee..371c213 100644 --- a/tests/compile/non_send.stderr +++ b/tests/compile/non_send.stderr @@ -1,26 +1,25 @@ error[E0277]: `Rc>` cannot be sent between threads safely - --> tests/compile/non_send.rs:11:9 - | -11 | lua.create_function(move |_, ()| { - | _________^^^^^^^^^^^^^^^_- - | | | - | | `Rc>` cannot be sent between threads safely -12 | | Ok(data.get()) -13 | | })? - | |_____- within this `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` - | - = help: within `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]`, the trait `Send` is not implemented for `Rc>` + --> tests/compile/non_send.rs:11:25 + | +11 | lua.create_function(move |_, ()| { + | --------------- ^----------- + | | | + | _________|_______________within this `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]` + | | | + | | required by a bound introduced by this call +12 | | Ok(data.get()) +13 | | })? + | |_____^ `Rc>` cannot be sent between threads safely + | + = help: within `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]`, the trait `Send` is not implemented for `Rc>` note: required because it's used within this closure - --> tests/compile/non_send.rs:11:25 - | -11 | lua.create_function(move |_, ()| { - | _________________________^ -12 | | Ok(data.get()) -13 | | })? - | |_____^ - = note: required because of the requirements on the impl of `mlua::types::MaybeSend` for `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` + --> tests/compile/non_send.rs:11:25 + | +11 | lua.create_function(move |_, ()| { + | ^^^^^^^^^^^^ + = note: required for `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]` to implement `mlua::types::MaybeSend` note: required by a bound in `Lua::create_function` - --> src/lua.rs - | - | F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result, - | ^^^^^^^^^ required by this bound in `Lua::create_function` + --> src/lua.rs + | + | F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result, + | ^^^^^^^^^ required by this bound in `Lua::create_function` diff --git a/tests/compile/ref_nounwindsafe.stderr b/tests/compile/ref_nounwindsafe.stderr index abfd705..0921840 100644 --- a/tests/compile/ref_nounwindsafe.stderr +++ b/tests/compile/ref_nounwindsafe.stderr @@ -1,24 +1,30 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> tests/compile/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 - | - = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` - = note: required because it appears within the type `alloc::sync::ArcInner>` - = note: required because it appears within the type `PhantomData>>` - = note: required because it appears within the type `Arc>` - = 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<'_>` +error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + --> tests/compile/ref_nounwindsafe.rs:8:18 + | +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 + | | + | required by a bound introduced by this call + | + = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` + = note: required because it appears within the type `ArcInner>` + = note: required because it appears within the type `PhantomData>>` + = note: required because it appears within the type `Arc>` + = note: required because it appears within the type `LuaInner` + = note: required because it appears within the type `ArcInner` + = note: required because it appears within the type `PhantomData>` + = note: required because it appears within the type `Arc` + = note: required because it appears within the type `Lua` + = note: required for `&Lua` to implement `UnwindSafe` + = note: required because it appears within the type `LuaRef<'_>` + = note: required because it appears within the type `Table<'_>` note: required because it's used within this closure - --> tests/compile/ref_nounwindsafe.rs:8:18 - | -8 | catch_unwind(move || table.set("a", "b").unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> tests/compile/ref_nounwindsafe.rs:8:18 + | +8 | catch_unwind(move || table.set("a", "b").unwrap()); + | ^^^^^^^ note: required by a bound in `catch_unwind` - --> $RUST/std/src/panic.rs - | - | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { - | ^^^^^^^^^^ required by this bound in `catch_unwind` + --> $RUST/std/src/panic.rs + | + | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { + | ^^^^^^^^^^ required by this bound in `catch_unwind` diff --git a/tests/compile/static_callback_args.stderr b/tests/compile/static_callback_args.stderr index bc61fa3..81da66c 100644 --- a/tests/compile/static_callback_args.stderr +++ b/tests/compile/static_callback_args.stderr @@ -1,15 +1,17 @@ error[E0597]: `lua` does not live long enough --> tests/compile/static_callback_args.rs:12:5 | -12 | / lua.create_function(|_, table: Table| { -13 | | BAD_TIME.with(|bt| { - | |_________- +10 | let lua = Lua::new(); + | --- binding `lua` declared here +11 | +12 | / lua.create_function(|_, table: Table| { +13 | |/ BAD_TIME.with(|bt| { 14 | || *bt.borrow_mut() = Some(table); 15 | || }); | ||__________- argument requires that `lua` is borrowed for `'static` -16 | | Ok(()) -17 | | })? - | |______^ borrowed value does not live long enough +16 | | Ok(()) +17 | | })? + | |_______^ borrowed value does not live long enough ... 32 | } | - `lua` dropped here while still borrowed @@ -17,15 +19,17 @@ error[E0597]: `lua` does not live long enough error[E0505]: cannot move out of `lua` because it is borrowed --> tests/compile/static_callback_args.rs:22:10 | -12 | / lua.create_function(|_, table: Table| { -13 | | BAD_TIME.with(|bt| { - | |_________- +10 | let lua = Lua::new(); + | --- binding `lua` declared here +11 | +12 | / lua.create_function(|_, table: Table| { +13 | |/ BAD_TIME.with(|bt| { 14 | || *bt.borrow_mut() = Some(table); 15 | || }); | ||__________- argument requires that `lua` is borrowed for `'static` -16 | | Ok(()) -17 | | })? - | |______- borrow of `lua` occurs here +16 | | Ok(()) +17 | | })? + | |_______- borrow of `lua` occurs here ... 22 | drop(lua); | ^^^ move out of `lua` occurs here