Files
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.

19 lines
557 B
Rust
Raw Normal View History

2023-12-07 11:56:48 +00:00
const unsafe extern "C" fn foo() -> usize {
5
}
2024-08-29 15:33:34 +02:00
const unsafe extern "C-unwind" fn bar() -> usize {
5
}
fn main() {
let a: [u8; foo()];
2023-12-07 11:56:48 +00:00
//~^ call to unsafe function `foo` is unsafe and requires unsafe function or block
foo();
2023-12-07 11:56:48 +00:00
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
2024-08-29 15:33:34 +02:00
let b: [u8; bar()];
//~^ call to unsafe function `bar` is unsafe and requires unsafe function or block
bar();
//~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block
}