rust/tests/ui/ffi-attrs/ffi_const2.rs
Folkert de Vries f472cc8cd4
error on unsafe attributes in pre-2024 editions
the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
2025-04-13 01:22:59 +02:00

12 lines
211 B
Rust

#![feature(ffi_const, ffi_pure)]
extern "C" {
#[unsafe(ffi_pure)] //~ ERROR `#[ffi_const]` function cannot be `#[ffi_pure]`
#[unsafe(ffi_const)]
pub fn baz();
}
fn main() {
unsafe { baz() };
}