diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-22 16:41:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-22 16:41:11 +0200 |
| commit | 221f677d70809bef43e22b689e41de88b31080f4 (patch) | |
| tree | 8aa890acc93b0261c8fad215c93d7e99ca349d2f /src/test/ui | |
| parent | e69141a52f61d3a48fb990d309a7b89ac78a2924 (diff) | |
| parent | 152c06569b6d785cea2d408c3ebd93aaee09772d (diff) | |
| download | rust-221f677d70809bef43e22b689e41de88b31080f4.tar.gz rust-221f677d70809bef43e22b689e41de88b31080f4.zip | |
Rollup merge of #71336 - ecstatic-morse:check-consts-asm, r=oli-obk
Exhaustively match on `{Statement,Terminator}Kind` during const checking
This adds a pre-monomorphization error for inline assembly in a const context as well.
r? @oli-obk
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/consts/inline_asm.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/consts/inline_asm.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/inline_asm.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/inline_asm.stderr | 10 |
4 files changed, 28 insertions, 1 deletions
diff --git a/src/test/ui/consts/inline_asm.rs b/src/test/ui/consts/inline_asm.rs new file mode 100644 index 00000000000..c2ab97e54f0 --- /dev/null +++ b/src/test/ui/consts/inline_asm.rs @@ -0,0 +1,6 @@ +#![feature(llvm_asm)] + +const _: () = unsafe { llvm_asm!("nop") }; +//~^ ERROR contains unimplemented expression type + +fn main() {} diff --git a/src/test/ui/consts/inline_asm.stderr b/src/test/ui/consts/inline_asm.stderr new file mode 100644 index 00000000000..0a064c81366 --- /dev/null +++ b/src/test/ui/consts/inline_asm.stderr @@ -0,0 +1,11 @@ +error[E0019]: constant contains unimplemented expression type + --> $DIR/inline_asm.rs:3:24 + | +LL | const _: () = unsafe { llvm_asm!("nop") }; + | ^^^^^^^^^^^^^^^^ + | + = 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 E0019`. diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs index f5613102562..ddc4767b83a 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.rs +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -11,4 +11,6 @@ static TEST_BAD: () = { //~^ ERROR could not evaluate static initializer //~| NOTE in this expansion of llvm_asm! //~| NOTE inline assembly is not supported + //~| WARN skipping const checks + //~| NOTE in this expansion of llvm_asm! }; diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr index 3cbdd326c82..444a0172621 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -1,3 +1,11 @@ +warning: skipping const checks + --> $DIR/inline_asm.rs:10:14 + | +LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0080]: could not evaluate static initializer --> $DIR/inline_asm.rs:10:14 | @@ -6,6 +14,6 @@ LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0080`. |
