-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
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.
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team