rust/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
2024-01-05 10:00:59 +00:00

13 lines
312 B
Rust

#![feature(const_extern_fn)]
const unsafe extern "C" fn foo() -> usize {
5
}
fn main() {
let a: [u8; foo()];
//~^ call to unsafe function `foo` is unsafe and requires unsafe function or block
foo();
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
}