asm 巨集
內聯彙編僅在每晚版本的 Rust 中得到支援,直到穩定為止。要啟用 asm! 巨集的使用,請使用主檔案頂部的以下要素屬性( 要素門 ):
#![feature(asm)]
然後在任何 unsafe 塊中使用 asm! 巨集:
fn do_nothing() {
unsafe {
asm!("NOP");
}
// asm!("NOP");
// That would be invalid here, because we are no longer in an
// unsafe block.
}