Rust Inline Assembly The asm! macro


Inline assembly will only be supported in nightly versions of Rust until it is stabilized. To enable usage of the asm! macro, use the following feature attribute at the top of the main file (a feature gate):


Then use the asm! macro in any unsafe block:

fn do_nothing() {
    unsafe {

    // asm!("NOP"); 
    // That would be invalid here, because we are no longer in an 
    // unsafe block.