blob: c02f2143d73bd8dfcc11fa8082a964f2cec1f8b2 [file]
//@ compile-flags: --crate-type rlib
// Tests whether it's an error to implement an unsafe EII safely.
#![feature(extern_item_impls)]
#![feature(decl_macro)]
#![feature(rustc_attrs)]
#![feature(eii_internals)]
// Uses manual desugaring of EII internals.
#[eii_declaration(bar, "unsafe")]
#[rustc_builtin_macro(eii_shared_macro)]
macro foo() {}
unsafe extern "Rust" {
safe fn bar(x: u64) -> u64;
}
#[foo] //~ ERROR `#[foo]` is unsafe to implement
fn other(x: u64) -> u64 {
x
}
// Uses the user-facing unsafe_eii wrapper.
#[unsafe_eii(baz)]
fn qux(x: u64) -> u64;
#[baz] //~ ERROR `#[baz]` is unsafe to implement
fn another(x: u64) -> u64 {
x
}
fn main() {
bar(0);
qux(0);
}