2020-05-04 06:56:42 -04:00
|
|
|
error[E0597]: `lua` does not live long enough
|
2022-04-13 09:30:52 -04:00
|
|
|
--> tests/compile/static_callback_args.rs:12:5
|
2020-05-04 06:56:42 -04:00
|
|
|
|
|
2022-04-13 09:30:52 -04:00
|
|
|
12 | / lua.create_function(|_, table: Table| {
|
2020-05-04 06:56:42 -04:00
|
|
|
13 | | BAD_TIME.with(|bt| {
|
|
|
|
14 | | *bt.borrow_mut() = Some(table);
|
|
|
|
15 | | });
|
|
|
|
16 | | Ok(())
|
|
|
|
17 | | })?
|
2022-04-13 09:30:52 -04:00
|
|
|
| | ^
|
|
|
|
| | |
|
|
|
|
| |______borrowed value does not live long enough
|
|
|
|
| argument requires that `lua` is borrowed for `'static`
|
2020-05-04 06:56:42 -04:00
|
|
|
...
|
|
|
|
32 | }
|
|
|
|
| - `lua` dropped here while still borrowed
|
|
|
|
|
|
|
|
error[E0505]: cannot move out of `lua` because it is borrowed
|
2022-04-13 09:30:52 -04:00
|
|
|
--> tests/compile/static_callback_args.rs:22:10
|
2020-05-04 06:56:42 -04:00
|
|
|
|
|
2022-04-13 09:30:52 -04:00
|
|
|
12 | / lua.create_function(|_, table: Table| {
|
2020-05-04 06:56:42 -04:00
|
|
|
13 | | BAD_TIME.with(|bt| {
|
|
|
|
14 | | *bt.borrow_mut() = Some(table);
|
|
|
|
15 | | });
|
|
|
|
16 | | Ok(())
|
|
|
|
17 | | })?
|
2022-04-13 09:30:52 -04:00
|
|
|
| | -
|
|
|
|
| | |
|
|
|
|
| |______borrow of `lua` occurs here
|
|
|
|
| argument requires that `lua` is borrowed for `'static`
|
2020-05-04 06:56:42 -04:00
|
|
|
...
|
|
|
|
22 | drop(lua);
|
|
|
|
| ^^^ move out of `lua` occurs here
|