From 295b6fd0f77c3c63c9bdfcec16e603749e21bc2f Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:56:10 +0000 Subject: [PATCH] Add a test for #22892 --- src/test/ui/asm/invalid-inline-asm.rs | 9 +++++++++ src/test/ui/asm/invalid-inline-asm.stderr | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/test/ui/asm/invalid-inline-asm.rs create mode 100644 src/test/ui/asm/invalid-inline-asm.stderr diff --git a/src/test/ui/asm/invalid-inline-asm.rs b/src/test/ui/asm/invalid-inline-asm.rs new file mode 100644 index 00000000000..1dcded0be0b --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm.rs @@ -0,0 +1,9 @@ +#![feature(asm)] + +fn main() { + let byte = 0; + let port = 0x80; + + unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } + //~^ ERROR couldn't allocate input reg for constraint 'a' +} diff --git a/src/test/ui/asm/invalid-inline-asm.stderr b/src/test/ui/asm/invalid-inline-asm.stderr new file mode 100644 index 00000000000..11a32d3141e --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm.stderr @@ -0,0 +1,8 @@ +error: couldn't allocate input reg for constraint 'a' + --> $DIR/invalid-inline-asm.rs:7:14 + | +LL | unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error +