diff --git a/src/test/ui/issue-53787-inline-assembler-macro.rs b/src/test/ui/issue-53787-inline-assembler-macro.rs new file mode 100644 index 00000000000..937bce1b655 --- /dev/null +++ b/src/test/ui/issue-53787-inline-assembler-macro.rs @@ -0,0 +1,23 @@ +// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. + +#![feature(asm)] + +macro_rules! fake_jump { + ($id:expr) => { + unsafe { + asm!( + " + jmp $0 + lea eax, [ebx] + xor eax, 0xDEADBEEF + retn + $0: + "::"0"($id)::"volatile", "intel"); + } + }; +} + +fn main() { + fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly + println!("Hello, world!"); +} diff --git a/src/test/ui/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issue-53787-inline-assembler-macro.stderr new file mode 100644 index 00000000000..69f380bdc9c --- /dev/null +++ b/src/test/ui/issue-53787-inline-assembler-macro.stderr @@ -0,0 +1,9 @@ +error[E0669]: invalid value for constraint in inline assembly + --> $DIR/issue-53787-inline-assembler-macro.rs:21:16 + | +LL | fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0669`.