Closed
Description
fn double(x: i32) -> i32 { x * 2 }
fn get_double_func() -> &'static (Fn(i32) -> i32)
{
// Works
const GET_DOUBLE_FUNC: &'static (Fn(i32) -> i32) = &double;
GET_DOUBLE_FUNC
}
fn get_double_func_2() -> &'static (Fn(i32) -> i32)
{
// Error message
&double
}
fn main() {}
It would be nice if the lifetime of &double
were the same in all contexts.