about summary refs log tree commit diff
path: root/tests/ui/unpretty/exhaustive-asm.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-29 15:24:54 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-05-02 12:41:02 +1000
commit3f842e51a6e97dad23f9717ae27db2960dde1c34 (patch)
treeb4d5c72d7f627a9058954cd1fa54af51787dc19d /tests/ui/unpretty/exhaustive-asm.rs
parent251cda5e1f0057eb04fd9fc1653f2f1e010e8f97 (diff)
downloadrust-3f842e51a6e97dad23f9717ae27db2960dde1c34.tar.gz
rust-3f842e51a6e97dad23f9717ae27db2960dde1c34.zip
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.
Diffstat (limited to 'tests/ui/unpretty/exhaustive-asm.rs')
-rw-r--r--tests/ui/unpretty/exhaustive-asm.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/unpretty/exhaustive-asm.rs b/tests/ui/unpretty/exhaustive-asm.rs
new file mode 100644
index 00000000000..74a45447a20
--- /dev/null
+++ b/tests/ui/unpretty/exhaustive-asm.rs
@@ -0,0 +1,31 @@
+//@ 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");
+    }
+}