clarify the scary transmute

This commit is contained in:
kyren 2018-02-11 08:22:15 -05:00
parent fd0e31c6ea
commit a91e3ed411
1 changed files with 2 additions and 2 deletions

View File

@ -1068,12 +1068,12 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
{
unsafe {
let f: Box<
Fn(&'callback Lua, MultiValue<'callback>) -> Result<MultiValue<'callback>>,
Fn(&'callback Lua, MultiValue<'callback>) -> Result<MultiValue<'callback>> + 'scope,
> = Box::new(move |lua, args| {
func(lua, A::from_lua_multi(args, lua)?)?.to_lua_multi(lua)
});
// SCARY, we are transmuting away the 'static requirement
// SCARY, we are transmuting the 'scope lifetime to 'static.
let mut f = self.lua.create_callback_function(mem::transmute(f))?;
f.0.drop_unref = false;