]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/miri_unleashed/abi-mismatch.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / consts / miri_unleashed / abi-mismatch.rs
1 // Checks that we report ABI mismatches for "const extern fn"
2 // compile-flags: -Z unleash-the-miri-inside-of-you
3
4 #![feature(const_extern_fn)]
5
6 const extern "C" fn c_fn() {}
7
8 const fn call_rust_fn(my_fn: extern "Rust" fn()) {
9 my_fn();
10 //~^ ERROR could not evaluate static initializer
11 //~| NOTE calling a function with calling convention C using calling convention Rust
12 //~| NOTE inside `call_rust_fn`
13 }
14
15 static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
16 //~^ NOTE inside `VAL`
17
18 fn main() {}