Update compile tests

This commit is contained in:
Alex Orlenko 2022-04-13 14:30:52 +01:00
parent ef81f40afa
commit 1ba7a409d5
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
8 changed files with 85 additions and 113 deletions

View File

@ -1,36 +1,41 @@
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/async_nonstatic_userdata.rs:11:72 --> tests/compile/async_nonstatic_userdata.rs:11:72
| |
11 | methods.add_async_method("print", |_, data, ()| async move { 11 | methods.add_async_method("print", |_, data, ()| async move {
| ________________________________________________________________________^ | ________________________________________________________________________^
12 | | println!("{}", data.0); 12 | | println!("{}", data.0);
13 | | Ok(()) 13 | | Ok(())
14 | | }); 14 | | });
| |_____________^ | |_____________^
| |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the impl at 9:10... note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/async_nonstatic_userdata.rs:9:10 --> tests/compile/async_nonstatic_userdata.rs:9:10
| |
9 | impl<'a> UserData for MyUserData<'a> { 9 | impl<'a> UserData for MyUserData<'a> {
| ^^ | ^^
note: ...so that the types are compatible note: ...so that the types are compatible
--> $DIR/async_nonstatic_userdata.rs:11:72 --> tests/compile/async_nonstatic_userdata.rs:11:72
| |
11 | methods.add_async_method("print", |_, data, ()| async move { 11 | methods.add_async_method("print", |_, data, ()| async move {
| ________________________________________________________________________^ | ________________________________________________________________________^
12 | | println!("{}", data.0); 12 | | println!("{}", data.0);
13 | | Ok(()) 13 | | Ok(())
14 | | }); 14 | | });
| |_____________^ | |_____________^
= note: expected `(MyUserData<'_>,)` = note: expected `(MyUserData<'_>,)`
found `(MyUserData<'a>,)` found `(MyUserData<'a>,)`
note: but, the lifetime must be valid for the lifetime `'lua` as defined on the method body at 10:24... note: but, the lifetime must be valid for the lifetime `'lua` as defined here...
--> $DIR/async_nonstatic_userdata.rs:10:24 --> tests/compile/async_nonstatic_userdata.rs:10:24
| |
10 | fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) { 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 note: ...so that the type `impl Future<Output = [async output]>` will meet its required lifetime bounds...
--> $DIR/async_nonstatic_userdata.rs:11:21 --> tests/compile/async_nonstatic_userdata.rs:11:21
| |
11 | methods.add_async_method("print", |_, data, ()| async move { 11 | methods.add_async_method("print", |_, data, ()| async move {
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
note: ...that is required by this bound
--> src/userdata.rs
|
| MR: 'lua + Future<Output = Result<R>>;
| ^^^^

View File

@ -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<mlua::lua::LuaInner>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
--> tests/compile/lua_norefunwindsafe.rs:7:5 --> tests/compile/lua_norefunwindsafe.rs:7:5
| |
7 | catch_unwind(|| lua.create_table().unwrap()); 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<mlua::lua::LuaInner>` 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<()>` = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::LuaInner>`
= note: required because it appears within the type `PhantomData<UnsafeCell<()>>` = note: required because it appears within the type `alloc::sync::ArcInner<UnsafeCell<mlua::lua::LuaInner>>`
= note: required because it appears within the type `Lua` = note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<UnsafeCell<mlua::lua::LuaInner>>>`
= note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` = note: required because it appears within the type `Arc<UnsafeCell<mlua::lua::LuaInner>>`
= 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<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
| ^^^^^^^^^^ required by this bound in `catch_unwind`
error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` 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<mlua::lua::ExtraData>` 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<mlua::lua::ExtraData>`
= note: required because it appears within the type `alloc::sync::ArcInner<UnsafeCell<mlua::lua::ExtraData>>`
= note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<UnsafeCell<mlua::lua::ExtraData>>>`
= note: required because it appears within the type `Arc<UnsafeCell<mlua::lua::ExtraData>>`
= note: required because it appears within the type `Lua` = 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 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 because it appears within the type `[closure@$DIR/tests/compile/lua_norefunwindsafe.rs:7:18: 7:48]`

View File

@ -1,14 +1,19 @@
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
--> $DIR/non_send.rs:11:9 --> tests/compile/non_send.rs:11:9
| |
11 | lua.create_function(move |_, ()| { 11 | lua.create_function(move |_, ()| {
| _________^^^^^^^^^^^^^^^_- | _________^^^^^^^^^^^^^^^_-
| | | | | |
| | `Rc<Cell<i32>>` cannot be sent between threads safely | | `Rc<Cell<i32>>` cannot be sent between threads safely
12 | | Ok(data.get()) 12 | | Ok(data.get())
13 | | })? 13 | | })?
| |_____- within this `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` | |_____- 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<Cell<i32>>` = help: within `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/tests/compile/non_send.rs:11:25: 13:6]` = 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 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<R>,
| ^^^^^^^^^ required by this bound in `Lua::create_function`

View File

@ -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<mlua::lua::LuaInner>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
--> tests/compile/ref_nounwindsafe.rs:8:5 --> tests/compile/ref_nounwindsafe.rs:8:5
| |
8 | catch_unwind(move || table.set("a", "b").unwrap()); 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<mlua::lua::LuaInner>` 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<()>` = help: within `Lua`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<mlua::lua::LuaInner>`
= note: required because it appears within the type `PhantomData<UnsafeCell<()>>` = note: required because it appears within the type `alloc::sync::ArcInner<UnsafeCell<mlua::lua::LuaInner>>`
= note: required because it appears within the type `Lua` = note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<UnsafeCell<mlua::lua::LuaInner>>>`
= note: required because of the requirements on the impl of `UnwindSafe` for `&Lua` = note: required because it appears within the type `Arc<UnsafeCell<mlua::lua::LuaInner>>`
= 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<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
| ^^^^^^^^^^ required by this bound in `catch_unwind`
error[E0277]: the type `UnsafeCell<mlua::lua::ExtraData>` 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<mlua::lua::ExtraData>` 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<mlua::lua::ExtraData>`
= note: required because it appears within the type `alloc::sync::ArcInner<UnsafeCell<mlua::lua::ExtraData>>`
= note: required because it appears within the type `PhantomData<alloc::sync::ArcInner<UnsafeCell<mlua::lua::ExtraData>>>`
= note: required because it appears within the type `Arc<UnsafeCell<mlua::lua::ExtraData>>`
= note: required because it appears within the type `Lua` = 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 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 `mlua::types::LuaRef<'_>`

View File

@ -19,7 +19,7 @@ error[E0373]: closure may outlive the current function, but it borrows `inner`,
--> tests/compile/scope_callback_inner.rs:8:34 --> tests/compile/scope_callback_inner.rs:8:34
| |
5 | lua.scope(|scope| { 5 | lua.scope(|scope| {
| ----- has type `&Scope<'_, '2>` | ----- has type `&mlua::Scope<'_, '2>`
... ...
8 | .create_function_mut(|_, t: Table| { 8 | .create_function_mut(|_, t: Table| {
| ^^^^^^^^^^^^^ may outlive borrowed value `inner` | ^^^^^^^^^^^^^ may outlive borrowed value `inner`

View File

@ -2,7 +2,7 @@ error[E0373]: closure may outlive the current function, but it borrows `test`, w
--> tests/compile/scope_invariance.rs:14:38 --> tests/compile/scope_invariance.rs:14:38
| |
9 | lua.scope(|scope| { 9 | lua.scope(|scope| {
| ----- has type `&Scope<'_, '1>` | ----- has type `&mlua::Scope<'_, '1>`
... ...
14 | .create_function_mut(|_, ()| { 14 | .create_function_mut(|_, ()| {
| ^^^^^^^ may outlive borrowed value `test` | ^^^^^^^ may outlive borrowed value `test`

View File

@ -1,8 +1,8 @@
error[E0597]: `ibad` does not live long enough 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| { 11 | lua.scope(|scope| {
| ----- has type `&Scope<'_, '1>` | ----- has type `&mlua::Scope<'_, '1>`
... ...
15 | scope.create_nonstatic_userdata(MyUserData(&ibad)).unwrap(); 15 | scope.create_nonstatic_userdata(MyUserData(&ibad)).unwrap();
| -------------------------------------------^^^^^-- | -------------------------------------------^^^^^--

View File

@ -1,35 +1,33 @@
error[E0597]: `lua` does not live long enough 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| { 12 | / lua.create_function(|_, table: Table| {
| -^^
| |
| _____borrowed value does not live long enough
| |
13 | | BAD_TIME.with(|bt| { 13 | | BAD_TIME.with(|bt| {
14 | | *bt.borrow_mut() = Some(table); 14 | | *bt.borrow_mut() = Some(table);
15 | | }); 15 | | });
16 | | Ok(()) 16 | | Ok(())
17 | | })? 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 | } 32 | }
| - `lua` dropped here while still borrowed | - `lua` dropped here while still borrowed
error[E0505]: cannot move out of `lua` because it is 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| { 12 | / lua.create_function(|_, table: Table| {
| ---
| |
| _____borrow of `lua` occurs here
| |
13 | | BAD_TIME.with(|bt| { 13 | | BAD_TIME.with(|bt| {
14 | | *bt.borrow_mut() = Some(table); 14 | | *bt.borrow_mut() = Some(table);
15 | | }); 15 | | });
16 | | Ok(()) 16 | | Ok(())
17 | | })? 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); 22 | drop(lua);
| ^^^ move out of `lua` occurs here | ^^^ move out of `lua` occurs here