summaryrefslogtreecommitdiffstats
path: root/tests/ui/asm/aarch64/srcloc.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/asm/aarch64/srcloc.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/asm/aarch64/srcloc.rs')
-rw-r--r--tests/ui/asm/aarch64/srcloc.rs129
1 files changed, 129 insertions, 0 deletions
diff --git a/tests/ui/asm/aarch64/srcloc.rs b/tests/ui/asm/aarch64/srcloc.rs
new file mode 100644
index 000000000..dbb6cbb94
--- /dev/null
+++ b/tests/ui/asm/aarch64/srcloc.rs
@@ -0,0 +1,129 @@
+// only-aarch64
+// build-fail
+// needs-asm-support
+// compile-flags: -Ccodegen-units=1
+
+use std::arch::asm;
+
+// Checks that inline asm errors are mapped to the correct line in the source code.
+
+fn main() {
+ unsafe {
+ asm!("invalid_instruction");
+ //~^ ERROR: unrecognized instruction mnemonic
+
+ asm!("
+ invalid_instruction
+ ");
+ //~^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(r#"
+ invalid_instruction
+ "#);
+ //~^^ ERROR: unrecognized instruction mnemonic
+
+ asm!("
+ mov x0, x0
+ invalid_instruction
+ mov x0, x0
+ ");
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(r#"
+ mov x0, x0
+ invalid_instruction
+ mov x0, x0
+ "#);
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(concat!("invalid", "_", "instruction"));
+ //~^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ "invalid_instruction",
+ );
+ //~^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ "mov x0, x0",
+ "invalid_instruction",
+ "mov x0, x0",
+ );
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ "mov x0, x0\n",
+ "invalid_instruction",
+ "mov x0, x0",
+ );
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ "mov x0, x0",
+ concat!("invalid", "_", "instruction"),
+ "mov x0, x0",
+ );
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ concat!("mov x0", ", ", "x0"),
+ concat!("invalid", "_", "instruction"),
+ concat!("mov x0", ", ", "x0"),
+ );
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ // Make sure template strings get separated
+ asm!(
+ "invalid_instruction1",
+ "invalid_instruction2",
+ );
+ //~^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ concat!(
+ "invalid", "_", "instruction1", "\n",
+ "invalid", "_", "instruction2",
+ ),
+ );
+ //~^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ concat!(
+ "invalid", "_", "instruction1", "\n",
+ "invalid", "_", "instruction2",
+ ),
+ concat!(
+ "invalid", "_", "instruction3", "\n",
+ "invalid", "_", "instruction4",
+ ),
+ );
+ //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ concat!(
+ "invalid", "_", "instruction1", "\n",
+ "invalid", "_", "instruction2", "\n",
+ ),
+ concat!(
+ "invalid", "_", "instruction3", "\n",
+ "invalid", "_", "instruction4", "\n",
+ ),
+ );
+ //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^ ERROR: unrecognized instruction mnemonic
+ //~^^^^^^^^ ERROR: unrecognized instruction mnemonic
+
+ asm!(
+ "",
+ "\n",
+ "invalid_instruction"
+ );
+ //~^^ ERROR: unrecognized instruction mnemonic
+ }
+}