2024-02-16 14:02:50 -06:00
|
|
|
//@ needs-asm-support
|
|
|
|
//@ build-pass
|
2022-05-06 20:57:42 -05:00
|
|
|
|
2022-10-17 16:38:37 -05:00
|
|
|
#![feature(asm_const)]
|
2022-05-06 20:57:42 -05:00
|
|
|
|
|
|
|
use std::arch::asm;
|
|
|
|
|
|
|
|
fn foofoo<const N: usize>() {}
|
|
|
|
|
|
|
|
unsafe fn foo<const N: usize>() {
|
|
|
|
asm!("/* {0} */", const N);
|
|
|
|
asm!("/* {0} */", const N + 1);
|
|
|
|
asm!("/* {0} */", sym foofoo::<N>);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn barbar<T>() {}
|
|
|
|
|
|
|
|
unsafe fn bar<T>() {
|
|
|
|
asm!("/* {0} */", const std::mem::size_of::<T>());
|
|
|
|
asm!("/* {0} */", const std::mem::size_of::<(T, T)>());
|
|
|
|
asm!("/* {0} */", sym barbar::<T>);
|
|
|
|
asm!("/* {0} */", sym barbar::<(T, T)>);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
foo::<0>();
|
|
|
|
bar::<usize>();
|
|
|
|
}
|
|
|
|
}
|