rust/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs

14 lines
410 B
Rust
Raw Normal View History

#![feature(const_extern_fn)]
const extern "C" fn unsize(x: &[u8; 3]) -> &[u8] { x }
const unsafe extern "C" fn closure() -> fn() { || {} }
2020-09-24 23:18:41 +00:00
//~^ ERROR function pointer
2020-09-30 01:32:38 +00:00
//~| ERROR function pointer cast
const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
2020-09-23 18:58:41 +00:00
//~^ ERROR floating point arithmetic
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
2020-09-17 17:32:07 +00:00
//~^ ERROR casting pointers to integers
fn main() {}