rust/tests/ui/asm/naked-functions-testattrs.rs
Folkert de Vries 562ec5a6fb disallow asm! in #[naked] functions
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-06 18:12:25 +02:00

40 lines
586 B
Rust

//@ needs-asm-support
//@ compile-flags: --test
#![allow(undefined_naked_function_abi)]
#![feature(naked_functions)]
#![feature(test)]
#![crate_type = "lib"]
use std::arch::naked_asm;
#[test]
#[naked]
//~^ ERROR [E0736]
fn test_naked() {
unsafe { naked_asm!("") };
}
#[should_panic]
#[test]
#[naked]
//~^ ERROR [E0736]
fn test_naked_should_panic() {
unsafe { naked_asm!("") };
}
#[ignore]
#[test]
#[naked]
//~^ ERROR [E0736]
fn test_naked_ignore() {
unsafe { naked_asm!("") };
}
#[bench]
#[naked]
//~^ ERROR [E0736]
fn bench_naked() {
unsafe { naked_asm!("") };
}