summaryrefslogtreecommitdiff
path: root/tests/compile-fail/function_borrow.rs
blob: 9c5382381a965cf061a546ca2220868b6a4cd6b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extern crate rlua;

use rlua::*;

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)
    });
}