rust/tests/ui/asm/naked-functions-inline.rs
Folkert de Vries 02378997ea bootstrap naked_asm! for compiler-builtins
in this commit, `naked_asm!` is an alias for `asm!` with one difference: `options(noreturn)` is always enabled by `naked_asm!`. That makes it future-compatible for when `naked_asm!` starts disallowing `options(noreturn)` later.
2024-09-09 12:47:40 +02:00

39 lines
637 B
Rust

//@ needs-asm-support
#![feature(naked_functions)]
#![crate_type = "lib"]
use std::arch::naked_asm;
#[naked]
pub unsafe extern "C" fn inline_none() {
naked_asm!("");
}
#[naked]
#[inline]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_hint() {
naked_asm!("");
}
#[naked]
#[inline(always)]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_always() {
naked_asm!("");
}
#[naked]
#[inline(never)]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_never() {
naked_asm!("");
}
#[naked]
#[cfg_attr(all(), inline(never))]
//~^ ERROR [E0736]
pub unsafe extern "C" fn conditional_inline_never() {
naked_asm!("");
}