From 1ba7a409d57f4db3abde7840adcbdf79a4478f17 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Wed, 13 Apr 2022 14:30:52 +0100 Subject: [PATCH] Update compile tests --- tests/compile/async_nonstatic_userdata.stderr | 73 ++++++++++--------- tests/compile/lua_norefunwindsafe.stderr | 29 ++------ tests/compile/non_send.stderr | 31 ++++---- tests/compile/ref_nounwindsafe.stderr | 31 ++------ tests/compile/scope_callback_inner.stderr | 2 +- tests/compile/scope_invariance.stderr | 2 +- tests/compile/scope_userdata_borrow.stderr | 4 +- tests/compile/static_callback_args.stderr | 26 +++---- 8 files changed, 85 insertions(+), 113 deletions(-) diff --git a/tests/compile/async_nonstatic_userdata.stderr b/tests/compile/async_nonstatic_userdata.stderr index e6f8cf7..c03a56a 100644 --- a/tests/compile/async_nonstatic_userdata.stderr +++ b/tests/compile/async_nonstatic_userdata.stderr @@ -1,36 +1,41 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/async_nonstatic_userdata.rs:11:72 - | -11 | methods.add_async_method("print", |_, data, ()| async move { - | ________________________________________________________________________^ -12 | | println!("{}", data.0); -13 | | Ok(()) -14 | | }); - | |_____________^ - | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the impl at 9:10... - --> $DIR/async_nonstatic_userdata.rs:9:10 - | -9 | impl<'a> UserData for MyUserData<'a> { - | ^^ + --> tests/compile/async_nonstatic_userdata.rs:11:72 + | +11 | methods.add_async_method("print", |_, data, ()| async move { + | ________________________________________________________________________^ +12 | | println!("{}", data.0); +13 | | Ok(()) +14 | | }); + | |_____________^ + | +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... + --> tests/compile/async_nonstatic_userdata.rs:9:10 + | +9 | impl<'a> UserData for MyUserData<'a> { + | ^^ note: ...so that the types are compatible - --> $DIR/async_nonstatic_userdata.rs:11:72 - | -11 | methods.add_async_method("print", |_, data, ()| async move { - | ________________________________________________________________________^ -12 | | println!("{}", data.0); -13 | | Ok(()) -14 | | }); - | |_____________^ - = note: expected `(MyUserData<'_>,)` - found `(MyUserData<'a>,)` -note: but, the lifetime must be valid for the lifetime `'lua` as defined on the method body at 10:24... - --> $DIR/async_nonstatic_userdata.rs:10:24 - | -10 | fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) { - | ^^^^ -note: ...so that the type `impl Future` will meet its required lifetime bounds - --> $DIR/async_nonstatic_userdata.rs:11:21 - | -11 | methods.add_async_method("print", |_, data, ()| async move { - | ^^^^^^^^^^^^^^^^ + --> tests/compile/async_nonstatic_userdata.rs:11:72 + | +11 | methods.add_async_method("print", |_, data, ()| async move { + | ________________________________________________________________________^ +12 | | println!("{}", data.0); +13 | | Ok(()) +14 | | }); + | |_____________^ + = note: expected `(MyUserData<'_>,)` + found `(MyUserData<'a>,)` +note: but, the lifetime must be valid for the lifetime `'lua` as defined here... + --> tests/compile/async_nonstatic_userdata.rs:10:24 + | +10 | fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) { + | ^^^^ +note: ...so that the type `impl Future` will meet its required lifetime bounds... + --> tests/compile/async_nonstatic_userdata.rs:11:21 + | +11 | methods.add_async_method("print", |_, data, ()| async move { + | ^^^^^^^^^^^^^^^^ +note: ...that is required by this bound + --> src/userdata.rs + | + | MR: 'lua + Future>; + | ^^^^ diff --git a/tests/compile/lua_norefunwindsafe.stderr b/tests/compile/lua_norefunwindsafe.stderr index 0a18a22..a441ec8 100644 --- a/tests/compile/lua_norefunwindsafe.stderr +++ b/tests/compile/lua_norefunwindsafe.stderr @@ -1,30 +1,13 @@ -error[E0277]: the type `UnsafeCell<()>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary +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 + | ^^^^^^^^^^^^ `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 `PhantomData>` - = 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]` -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` - -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>` + = 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 `[closure@$DIR/tests/compile/lua_norefunwindsafe.rs:7:18: 7:48]` diff --git a/tests/compile/non_send.stderr b/tests/compile/non_send.stderr index 6a86081..ecec24c 100644 --- a/tests/compile/non_send.stderr +++ b/tests/compile/non_send.stderr @@ -1,14 +1,19 @@ error[E0277]: `Rc>` cannot be sent between threads safely - --> $DIR/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>` - = note: required because it appears within the type `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` - = 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: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>` + = note: required because it appears within the type `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` + = 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]` +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` diff --git a/tests/compile/ref_nounwindsafe.stderr b/tests/compile/ref_nounwindsafe.stderr index 0441da5..8d3704d 100644 --- a/tests/compile/ref_nounwindsafe.stderr +++ b/tests/compile/ref_nounwindsafe.stderr @@ -1,32 +1,13 @@ -error[E0277]: the type `UnsafeCell<()>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary +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 + | ^^^^^^^^^^^^ `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 `PhantomData>` - = 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]` -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` - -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>` + = 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<'_>` diff --git a/tests/compile/scope_callback_inner.stderr b/tests/compile/scope_callback_inner.stderr index c2abbe7..55c38b9 100644 --- a/tests/compile/scope_callback_inner.stderr +++ b/tests/compile/scope_callback_inner.stderr @@ -19,7 +19,7 @@ error[E0373]: closure may outlive the current function, but it borrows `inner`, --> tests/compile/scope_callback_inner.rs:8:34 | 5 | lua.scope(|scope| { - | ----- has type `&Scope<'_, '2>` + | ----- has type `&mlua::Scope<'_, '2>` ... 8 | .create_function_mut(|_, t: Table| { | ^^^^^^^^^^^^^ may outlive borrowed value `inner` diff --git a/tests/compile/scope_invariance.stderr b/tests/compile/scope_invariance.stderr index b1e68fb..9c91f6a 100644 --- a/tests/compile/scope_invariance.stderr +++ b/tests/compile/scope_invariance.stderr @@ -2,7 +2,7 @@ error[E0373]: closure may outlive the current function, but it borrows `test`, w --> tests/compile/scope_invariance.rs:14:38 | 9 | lua.scope(|scope| { - | ----- has type `&Scope<'_, '1>` + | ----- has type `&mlua::Scope<'_, '1>` ... 14 | .create_function_mut(|_, ()| { | ^^^^^^^ may outlive borrowed value `test` diff --git a/tests/compile/scope_userdata_borrow.stderr b/tests/compile/scope_userdata_borrow.stderr index 02e1bdb..9d89804 100644 --- a/tests/compile/scope_userdata_borrow.stderr +++ b/tests/compile/scope_userdata_borrow.stderr @@ -1,8 +1,8 @@ error[E0597]: `ibad` does not live long enough - --> $DIR/scope_userdata_borrow.rs:15:56 + --> tests/compile/scope_userdata_borrow.rs:15:56 | 11 | lua.scope(|scope| { - | ----- has type `&Scope<'_, '1>` + | ----- has type `&mlua::Scope<'_, '1>` ... 15 | scope.create_nonstatic_userdata(MyUserData(&ibad)).unwrap(); | -------------------------------------------^^^^^-- diff --git a/tests/compile/static_callback_args.stderr b/tests/compile/static_callback_args.stderr index 561bcbe..0683dee 100644 --- a/tests/compile/static_callback_args.stderr +++ b/tests/compile/static_callback_args.stderr @@ -1,35 +1,33 @@ error[E0597]: `lua` does not live long enough - --> $DIR/static_callback_args.rs:12:5 + --> tests/compile/static_callback_args.rs:12:5 | -12 | lua.create_function(|_, table: Table| { - | -^^ - | | - | _____borrowed value does not live long enough - | | +12 | / lua.create_function(|_, table: Table| { 13 | | BAD_TIME.with(|bt| { 14 | | *bt.borrow_mut() = Some(table); 15 | | }); 16 | | Ok(()) 17 | | })? - | |______- argument requires that `lua` is borrowed for `'static` + | | ^ + | | | + | |______borrowed value does not live long enough + | argument requires that `lua` is borrowed for `'static` ... 32 | } | - `lua` dropped here while still borrowed error[E0505]: cannot move out of `lua` because it is borrowed - --> $DIR/static_callback_args.rs:22:10 + --> tests/compile/static_callback_args.rs:22:10 | -12 | lua.create_function(|_, table: Table| { - | --- - | | - | _____borrow of `lua` occurs here - | | +12 | / lua.create_function(|_, table: Table| { 13 | | BAD_TIME.with(|bt| { 14 | | *bt.borrow_mut() = Some(table); 15 | | }); 16 | | Ok(()) 17 | | })? - | |______- argument requires that `lua` is borrowed for `'static` + | | - + | | | + | |______borrow of `lua` occurs here + | argument requires that `lua` is borrowed for `'static` ... 22 | drop(lua); | ^^^ move out of `lua` occurs here