diff options
Diffstat (limited to 'tests/compile')
-rw-r--r-- | tests/compile/async_any_userdata_method.stderr | 4 | ||||
-rw-r--r-- | tests/compile/lua_norefunwindsafe.stderr | 48 | ||||
-rw-r--r-- | tests/compile/non_send.stderr | 9 | ||||
-rw-r--r-- | tests/compile/ref_nounwindsafe.stderr | 60 | ||||
-rw-r--r-- | tests/compile/scope_userdata_borrow.stderr | 2 | ||||
-rw-r--r-- | tests/compile/static_callback_args.stderr | 44 |
6 files changed, 121 insertions, 46 deletions
diff --git a/tests/compile/async_any_userdata_method.stderr b/tests/compile/async_any_userdata_method.stderr index d5e5c38..f1b5e17 100644 --- a/tests/compile/async_any_userdata_method.stderr +++ b/tests/compile/async_any_userdata_method.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough 9 | reg.add_async_method("t", |_, this: &String, ()| async { | ___________________________________----------------------_^ | | | | - | | | return type of closure `[async block@$DIR/tests/compile/async_any_userdata_method.rs:9:58: 12:10]` contains a lifetime `'2` + | | | return type of closure `{async block@$DIR/tests/compile/async_any_userdata_method.rs:9:58: 12:10}` contains a lifetime `'2` | | lifetime `'1` represents this closure's body 10 | | s = this; 11 | | Ok(()) @@ -27,6 +27,8 @@ error[E0596]: cannot borrow `s` as mutable, as it is a captured variable in a `F error[E0597]: `s` does not live long enough --> tests/compile/async_any_userdata_method.rs:8:21 | +7 | let s = String::new(); + | - binding `s` declared here 8 | let mut s = &s; | ^^ borrowed value does not live long enough 9 | / reg.add_async_method("t", |_, this: &String, ()| async { diff --git a/tests/compile/lua_norefunwindsafe.stderr b/tests/compile/lua_norefunwindsafe.stderr index a442d0b..9771dd1 100644 --- a/tests/compile/lua_norefunwindsafe.stderr +++ b/tests/compile/lua_norefunwindsafe.stderr @@ -7,14 +7,46 @@ error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` may contain interior m | required by a bound introduced by this call | = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::ExtraData>` - = note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>` - = note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>` - = note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>` - = note: required because it appears within the type `LuaInner` - = note: required because it appears within the type `ArcInner<LuaInner>` - = note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>` - = note: required because it appears within the type `Arc<LuaInner>` - = note: required because it appears within the type `Lua` +note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>` + --> $RUST/alloc/src/sync.rs + | + | struct ArcInner<T: ?Sized> { + | ^^^^^^^^ +note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData<T: ?Sized>; + | ^^^^^^^^^^^ +note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>` + --> $RUST/alloc/src/sync.rs + | + | pub struct Arc< + | ^^^ +note: required because it appears within the type `LuaInner` + --> src/lua.rs + | + | pub struct LuaInner { + | ^^^^^^^^ +note: required because it appears within the type `ArcInner<LuaInner>` + --> $RUST/alloc/src/sync.rs + | + | struct ArcInner<T: ?Sized> { + | ^^^^^^^^ +note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData<T: ?Sized>; + | ^^^^^^^^^^^ +note: required because it appears within the type `Arc<LuaInner>` + --> $RUST/alloc/src/sync.rs + | + | pub struct Arc< + | ^^^ +note: required because it appears within the type `Lua` + --> src/lua.rs + | + | pub struct Lua(Arc<LuaInner>); + | ^^^ = note: required for `&Lua` to implement `UnwindSafe` note: required because it's used within this closure --> tests/compile/lua_norefunwindsafe.rs:7:18 diff --git a/tests/compile/non_send.stderr b/tests/compile/non_send.stderr index 38fc404..408b682 100644 --- a/tests/compile/non_send.stderr +++ b/tests/compile/non_send.stderr @@ -4,22 +4,25 @@ error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely 11 | lua.create_function(move |_, ()| { | --------------- ^----------- | | | - | _________|_______________within this `[closure@$DIR/tests/compile/non_send.rs:11:25: 11:37]` + | _________|_______________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<Cell<i32>>` 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<Cell<i32>>` + = help: within `{closure@$DIR/tests/compile/non_send.rs:11:25: 11:37}`, the trait `Send` is not implemented for `Rc<Cell<i32>>` note: required because it's used within this closure --> 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 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 | + | pub fn create_function<'lua, A, R, F>(&'lua self, func: F) -> Result<Function<'lua>> + | --------------- required by a bound in this associated function +... | F: Fn(&'lua Lua, A) -> Result<R> + MaybeSend + 'static, | ^^^^^^^^^ required by this bound in `Lua::create_function` diff --git a/tests/compile/ref_nounwindsafe.stderr b/tests/compile/ref_nounwindsafe.stderr index 0921840..342dc7b 100644 --- a/tests/compile/ref_nounwindsafe.stderr +++ b/tests/compile/ref_nounwindsafe.stderr @@ -7,17 +7,57 @@ error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` may contain interior m | required by a bound introduced by this call | = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::ExtraData>` - = note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>` - = note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>` - = note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>` - = note: required because it appears within the type `LuaInner` - = note: required because it appears within the type `ArcInner<LuaInner>` - = note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>` - = note: required because it appears within the type `Arc<LuaInner>` - = note: required because it appears within the type `Lua` +note: required because it appears within the type `ArcInner<UnsafeCell<ExtraData>>` + --> $RUST/alloc/src/sync.rs + | + | struct ArcInner<T: ?Sized> { + | ^^^^^^^^ +note: required because it appears within the type `PhantomData<ArcInner<UnsafeCell<ExtraData>>>` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData<T: ?Sized>; + | ^^^^^^^^^^^ +note: required because it appears within the type `Arc<UnsafeCell<ExtraData>>` + --> $RUST/alloc/src/sync.rs + | + | pub struct Arc< + | ^^^ +note: required because it appears within the type `LuaInner` + --> src/lua.rs + | + | pub struct LuaInner { + | ^^^^^^^^ +note: required because it appears within the type `ArcInner<LuaInner>` + --> $RUST/alloc/src/sync.rs + | + | struct ArcInner<T: ?Sized> { + | ^^^^^^^^ +note: required because it appears within the type `PhantomData<ArcInner<LuaInner>>` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData<T: ?Sized>; + | ^^^^^^^^^^^ +note: required because it appears within the type `Arc<LuaInner>` + --> $RUST/alloc/src/sync.rs + | + | pub struct Arc< + | ^^^ +note: required because it appears within the type `Lua` + --> src/lua.rs + | + | pub struct Lua(Arc<LuaInner>); + | ^^^ = 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 appears within the type `LuaRef<'_>` + --> src/types.rs + | + | pub(crate) struct LuaRef<'lua> { + | ^^^^^^ +note: required because it appears within the type `Table<'_>` + --> src/table.rs + | + | pub struct Table<'lua>(pub(crate) LuaRef<'lua>); + | ^^^^^ note: required because it's used within this closure --> tests/compile/ref_nounwindsafe.rs:8:18 | diff --git a/tests/compile/scope_userdata_borrow.stderr b/tests/compile/scope_userdata_borrow.stderr index 9d89804..132acdd 100644 --- a/tests/compile/scope_userdata_borrow.stderr +++ b/tests/compile/scope_userdata_borrow.stderr @@ -4,6 +4,8 @@ error[E0597]: `ibad` does not live long enough 11 | lua.scope(|scope| { | ----- has type `&mlua::Scope<'_, '1>` ... +14 | let ibad = 42; + | ---- binding `ibad` declared here 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 81da66c..2bf660b 100644 --- a/tests/compile/static_callback_args.stderr +++ b/tests/compile/static_callback_args.stderr @@ -1,35 +1,31 @@ error[E0597]: `lua` does not live long enough --> tests/compile/static_callback_args.rs:12:5 | -10 | let lua = Lua::new(); - | --- binding `lua` declared here +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 +12 | lua.create_function(|_, table: Table| { + | ^^^ borrowed value does not live long enough +13 | / BAD_TIME.with(|bt| { +14 | | *bt.borrow_mut() = Some(table); +15 | | }); + | |__________- argument requires that `lua` is borrowed for `'static` ... -32 | } - | - `lua` dropped here while still borrowed +32 | } + | - `lua` dropped here while still borrowed error[E0505]: cannot move out of `lua` because it is borrowed --> tests/compile/static_callback_args.rs:22:10 | -10 | let lua = Lua::new(); - | --- binding `lua` declared here +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 +12 | lua.create_function(|_, table: Table| { + | --- borrow of `lua` occurs here +13 | / BAD_TIME.with(|bt| { +14 | | *bt.borrow_mut() = Some(table); +15 | | }); + | |__________- argument requires that `lua` is borrowed for `'static` ... -22 | drop(lua); - | ^^^ move out of `lua` occurs here +22 | drop(lua); + | ^^^ move out of `lua` occurs here |