Files
mlua-rs-mlua/tests/compile-fail/function_borrow.rs
T
2018-09-16 20:15:51 -04:00

16 lines
355 B
Rust

extern crate rlua;
use rlua::{Function, Lua, Result};
fn main() {
let lua = Lua::new();
struct Test(i32);
let test = Test(0);
let func = lua.create_function(|_, ()| -> Result<i32> {
//~^ error: closure may outlive the current function, but it borrows `test`, which is owned by the current function
Ok(test.0)
});
}