]>
git.proxmox.com Git - rustc.git/blob - tests/ui/consts/const-extern-fn/const-extern-fn.rs
2 #![feature(const_extern_fn)]
4 const extern "C" fn foo1(val
: u8) -> u8 {
8 const extern "C" fn foo2(val
: u8) -> u8 {
12 const unsafe extern "C" fn bar1(val
: bool
) -> bool
{
16 const unsafe extern "C" fn bar2(val
: bool
) -> bool
{
22 let a
: [u8; foo1(25) as usize] = [0; 26];
23 let b
: [u8; foo2(25) as usize] = [0; 26];
26 let bar1_res
= unsafe { bar1(false) }
;
27 let bar2_res
= unsafe { bar2(false) }
;
29 assert_eq
!(bar1_res
, bar2_res
);
31 let _foo1_cast
: extern "C" fn(u8) -> u8 = foo1
;
32 let _foo2_cast
: extern "C" fn(u8) -> u8 = foo2
;
33 let _bar1_cast
: unsafe extern "C" fn(bool
) -> bool
= bar1
;
34 let _bar2_cast
: unsafe extern "C" fn(bool
) -> bool
= bar2
;