2021-04-24 19:00:00 -05:00
|
|
|
pub static V: &u32 = &X;
|
|
|
|
pub static F: fn() = f;
|
2023-08-21 19:00:00 -05:00
|
|
|
pub static G: fn() = G0;
|
2024-03-12 02:00:01 -05:00
|
|
|
pub static H: &(dyn Fn() + Sync) = &h;
|
|
|
|
pub static I: fn() = Helper(j).mk();
|
2024-06-03 19:00:00 -05:00
|
|
|
pub static K: fn() -> fn() = {
|
|
|
|
#[inline(never)]
|
|
|
|
fn k() {}
|
|
|
|
#[inline(always)]
|
|
|
|
|| -> fn() { k }
|
|
|
|
};
|
2021-04-24 19:00:00 -05:00
|
|
|
|
|
|
|
static X: u32 = 42;
|
2023-08-21 19:00:00 -05:00
|
|
|
static G0: fn() = g;
|
2021-04-24 19:00:00 -05:00
|
|
|
|
|
|
|
pub fn v() -> *const u32 {
|
|
|
|
V
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f() {}
|
2023-08-21 19:00:00 -05:00
|
|
|
|
|
|
|
fn g() {}
|
2024-03-12 02:00:01 -05:00
|
|
|
|
|
|
|
fn h() {}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
struct Helper<T: Copy>(T);
|
|
|
|
|
|
|
|
impl<T: Copy + FnOnce()> Helper<T> {
|
|
|
|
const fn mk(self) -> fn() {
|
|
|
|
i::<T>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn i<T: FnOnce()>() {
|
|
|
|
assert_eq!(std::mem::size_of::<T>(), 0);
|
|
|
|
// unsafe to work around the lack of a `Default` impl for function items
|
|
|
|
unsafe { (std::mem::transmute_copy::<(), T>(&()))() }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn j() {}
|