mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
36 lines
725 B
Rust
36 lines
725 B
Rust
//@ edition: 2021
|
|
//@ needs-asm-support
|
|
//@ ignore-nvptx64
|
|
//@ ignore-spirv
|
|
|
|
#![feature(naked_functions)]
|
|
#![crate_type = "lib"]
|
|
|
|
use std::arch::naked_asm;
|
|
|
|
fn main() {
|
|
test1();
|
|
}
|
|
|
|
#[naked]
|
|
extern "C" fn test1() {
|
|
unsafe { naked_asm!("") }
|
|
}
|
|
|
|
extern "C" fn test2() {
|
|
unsafe { naked_asm!("") }
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[naked]`
|
|
}
|
|
|
|
extern "C" fn test3() {
|
|
unsafe { (|| naked_asm!(""))() }
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[naked]`
|
|
}
|
|
|
|
fn test4() {
|
|
async move {
|
|
unsafe { naked_asm!("") } ;
|
|
//~^ ERROR the `naked_asm!` macro can only be used in functions marked with `#[naked]`
|
|
};
|
|
}
|