2021-03-14 14:11:37 -05:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2019-09-29 18:22:18 -05:00
|
|
|
#![feature(const_extern_fn)]
|
|
|
|
|
2020-09-01 16:28:11 -05:00
|
|
|
const unsafe extern "C" fn foo() -> usize { 5 }
|
2019-09-29 18:22:18 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a: [u8; foo()];
|
2022-04-26 05:43:00 -05:00
|
|
|
//[mir]~^ call to unsafe function is unsafe and requires unsafe function or block
|
|
|
|
//[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block
|
2019-09-29 18:22:18 -05:00
|
|
|
foo();
|
2022-04-26 05:43:00 -05:00
|
|
|
//[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block
|
2019-09-29 18:22:18 -05:00
|
|
|
}
|