RS.CLIPPY.POINTERS_IN_NOMEM_ASM_BLOCK
Pointers in nomem asm block
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: pointers_in_nomem_asm_block. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks if any pointer is being passed to an asm! block with nomem option.
Why is this bad?
nomem forbids any reads or writes to memory and passing a pointer suggests
that either of those will happen.
Example
fn f(p: *mut u32) {
unsafe { core::arch::asm!("mov [{p}], 42", p = in(reg) p, options(nomem, nostack)); }
}
Use instead:
fn f(p: *mut u32) {
unsafe { core::arch::asm!("mov [{p}], 42", p = in(reg) p, options(nostack)); }
}