From 56884581ecd8b5788a343ca80ba5d3c639114fbc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 19 Apr 2020 12:05:28 +0200 Subject: [PATCH 1/2] miri-unleash test for llvm_asm --- src/test/ui/consts/miri_unleashed/inline_asm.rs | 15 +++++++++++++++ .../ui/consts/miri_unleashed/inline_asm.stderr | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/test/ui/consts/miri_unleashed/inline_asm.rs create mode 100644 src/test/ui/consts/miri_unleashed/inline_asm.stderr diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs new file mode 100644 index 00000000000..5888d1e816a --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -0,0 +1,15 @@ +// compile-flags: -Zunleash-the-miri-inside-of-you +// only-x86_64 +#![feature(llvm_asm)] +#![allow(const_err)] + +fn main() {} + +// Make sure we catch executing bad drop functions. +// The actual error is tested by the error-pattern above. +static TEST_BAD: () = { + unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } + //~^ ERROR could not evaluate static initializer + //~| NOTE in this expansion of llvm_asm! + //~| NOTE inline assembly is not supported +}; diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr new file mode 100644 index 00000000000..5381c898d3f --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -0,0 +1,11 @@ +error[E0080]: could not evaluate static initializer + --> $DIR/inline_asm.rs:11:14 + | +LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline assembly is not supported + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. From f6adbc3a26e6bfc5b1d6a1cc9eedaf1786786e58 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 19 Apr 2020 20:21:26 +0200 Subject: [PATCH 2/2] Fix comment --- src/test/ui/consts/miri_unleashed/inline_asm.rs | 3 +-- src/test/ui/consts/miri_unleashed/inline_asm.stderr | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs index 5888d1e816a..f5613102562 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.rs +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -5,8 +5,7 @@ fn main() {} -// Make sure we catch executing bad drop functions. -// The actual error is tested by the error-pattern above. +// Make sure we catch executing inline assembly. static TEST_BAD: () = { unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } //~^ ERROR could not evaluate static initializer diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr index 5381c898d3f..3cbdd326c82 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/inline_asm.rs:11:14 + --> $DIR/inline_asm.rs:10:14 | LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline assembly is not supported