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-08-23 18:12:37 -04:00
|
|
|
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
|
2020-05-04 06:56:42 -04:00
|
|
|
...
|
2022-08-23 18:12:37 -04:00
|
|
|
32 | }
|
|
|
|
| - `lua` dropped here while still borrowed
|
2020-05-04 06:56:42 -04:00
|
|
|
|
|
|
|
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-08-23 18:12:37 -04:00
|
|
|
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
|
2020-05-04 06:56:42 -04:00
|
|
|
...
|
2022-08-23 18:12:37 -04:00
|
|
|
22 | drop(lua);
|
|
|
|
| ^^^ move out of `lua` occurs here
|