2024-09-10 14:42:17 +02:00
|
|
|
//@ edition: 2021
|
|
|
|
//@ needs-asm-support
|
|
|
|
//@ ignore-nvptx64
|
|
|
|
//@ ignore-spirv
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
use std::arch::naked_asm;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test1();
|
|
|
|
}
|
|
|
|
|
2025-03-29 17:30:11 +01:00
|
|
|
#[unsafe(naked)]
|
2024-09-10 14:42:17 +02:00
|
|
|
extern "C" fn test1() {
|
2025-03-29 17:30:11 +01:00
|
|
|
naked_asm!("")
|
2024-09-10 14:42:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" fn test2() {
|
2025-03-29 17:30:11 +01:00
|
|
|
naked_asm!("")
|
|
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
|
2024-09-10 14:42:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" fn test3() {
|
2025-03-29 17:30:11 +01:00
|
|
|
(|| naked_asm!(""))()
|
|
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
|
2024-09-10 14:42:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test4() {
|
|
|
|
async move {
|
2025-03-29 17:30:11 +01:00
|
|
|
naked_asm!("");
|
|
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
|
2024-09-10 14:42:17 +02:00
|
|
|
};
|
|
|
|
}
|