]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/miri_unleashed/abi-mismatch.rs
miri-unleash tests: ensure they fire even with 'allow(const_err)'
[rust.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 #![allow(const_err)]
6
7 const extern "C" fn c_fn() {}
8
9 const fn call_rust_fn(my_fn: extern "Rust" fn()) {
10     my_fn();
11     //~^ WARN skipping const checks
12     //~| ERROR could not evaluate static initializer
13     //~| NOTE calling a function with ABI C using caller ABI Rust
14     //~| NOTE inside `call_rust_fn`
15 }
16
17 static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
18 //~^ WARN skipping const checks
19 //~| NOTE inside `VAL`
20
21 fn main() {}