Skip to main content

## NAMED_ASM_LABELS

# Static NAMED_ASM_LABELS

Source

    pub static NAMED_ASM_LABELS: &Lint

Expand description

The `named_asm_labels` lint detects the use of named labels in the inline `asm!` macro.

#### §Example

ⓘ

    use std::arch::asm;

    fn main() {
        unsafe {
            asm!("foo: bar");
        }
    }

{{produces}}

#### §Explanation

LLVM is allowed to duplicate inline assembly blocks for any reason, for example when it is in a function that gets inlined. Because of this, GNU assembler local labels must be used instead of labels with a name. Using named labels might cause assembler or linker errors.

See the explanation in Rust By Example for more details.