rust/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
312 B
Rust
Raw Normal View History

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