rust-clippy/tests/ui/crashes/ice-8850.fixed
2023-08-11 14:02:28 +00:00

27 lines
456 B
Rust

fn fn_pointer_static() -> usize {
static FN: fn() -> usize = || 1;
FN() + 1
}
fn fn_pointer_const() -> usize {
const FN: fn() -> usize = || 1;
FN() + 1
}
fn deref_to_dyn_fn() -> usize {
struct Derefs;
impl std::ops::Deref for Derefs {
type Target = dyn Fn() -> usize;
fn deref(&self) -> &Self::Target {
&|| 2
}
}
static FN: Derefs = Derefs;
FN() + 1
}
fn main() {}