rust/tests/ui/unpretty/exhaustive-asm.rs
Nicholas Nethercote 3f842e51a6 Improve coverage of HIR pretty printing.
By taking the existing `expanded-exhaustive.rs` test and running it with
both `Zunpretty=expanded` *and* `Zunpretty=hir`.

Also rename some files, and split the asm parts out so they only run on
x86-64.
2025-05-02 12:41:02 +10:00

32 lines
707 B
Rust

//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-pass
//@ edition:2024
//@ only-x86_64
//
// asm parts of exhaustive.rs. Separate because we only run this on x86_64.
mod expressions {
/// ExprKind::InlineAsm
fn expr_inline_asm() {
let x;
core::arch::asm!(
"mov {tmp}, {x}",
"shl {tmp}, 1",
"shl {x}, 2",
"add {x}, {tmp}",
x = inout(reg) x,
tmp = out(reg) _,
);
}
}
mod items {
/// ItemKind::GlobalAsm
mod item_global_asm {
core::arch::global_asm!(".globl my_asm_func");
}
}