Static rustc_lint_defs::builtin::BAD_ASM_STYLE[−][src]

pub static BAD_ASM_STYLE: &Lint
Expand description

The bad_asm_style lint detects the use of the .intel_syntax and .att_syntax directives.

Example

ⓘ
#[cfg(target_arch="x86_64")]
use std::arch::asm;

fn main() {
    #[cfg(target_arch="x86_64")]
    unsafe {
        asm!(
            ".att_syntax",
            "movq %{0}, %{0}", in(reg) 0usize
        );
    }
}

{{produces}}

Explanation

On x86, asm! uses the intel assembly syntax by default. While this can be switched using assembler directives like .att_syntax, using the att_syntax option is recommended instead because it will also properly prefix register placeholders with % as required by AT&T syntax.