Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

asm_nonnull_inputs

The tracking issue for this feature is: #166132


This feature allows thin NonNull pointers to be used as input operands in inline assembly.

Example:

let mut x = 1;
let p = core::ptr::NonNull::from_mut(&mut x);

unsafe {
    core::arch::asm!(
        "mov dword ptr [{}], 2",
        in(reg) p,
    )
};

assert_eq!(x, 2);