rust/tests/ui/feature-gates/feature-gate-unsafe-extern-blocks.rs
2024-06-20 14:14:49 -04:00

14 lines
357 B
Rust

unsafe extern "C" {
//~^ ERROR extern block cannot be declared unsafe
}
// We can't gate `unsafe extern` blocks themselves since they were previously
// allowed, but we should gate the `safe` soft keyword.
#[cfg(any())]
unsafe extern "C" {
safe fn foo();
//~^ ERROR `unsafe extern {}` blocks and `safe` keyword are experimental
}
fn main() {}