From 28aec1beaa5e16b17143f993cab408debe1dcda5 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 17 Nov 2019 01:11:35 +0300 Subject: [PATCH] Add some more tests --- src/test/ui/asm/asm-literal-escaping.rs | 12 ++++++++++ src/test/ui/proc-macro/span-preservation.rs | 10 ++++++++ .../ui/proc-macro/span-preservation.stderr | 24 ++++++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/asm/asm-literal-escaping.rs diff --git a/src/test/ui/asm/asm-literal-escaping.rs b/src/test/ui/asm/asm-literal-escaping.rs new file mode 100644 index 0000000000000..8d464e752e637 --- /dev/null +++ b/src/test/ui/asm/asm-literal-escaping.rs @@ -0,0 +1,12 @@ +// build-pass +// only-x86_64 + +#![feature(asm)] + +fn main() { + unsafe { + // "nop" :: "r"(x) : "eax" : "volatile" + let x = 10; + asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); + } +} diff --git a/src/test/ui/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs index 8b8e12fcba653..b22e50c4c1715 100644 --- a/src/test/ui/proc-macro/span-preservation.rs +++ b/src/test/ui/proc-macro/span-preservation.rs @@ -44,4 +44,14 @@ extern "C" fn baz() { 0 //~ ERROR mismatched types } +#[recollect_attr] +extern "Rust" fn rust_abi() { + 0 //~ ERROR mismatched types +} + +#[recollect_attr] +extern "\x43" fn c_abi_escaped() { + 0 //~ ERROR mismatched types +} + fn main() {} diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index 9e9271f529c73..545c2fa5f40e4 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -52,7 +52,29 @@ LL | 0 = note: expected type `()` found type `{integer}` -error: aborting due to 6 previous errors +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:49:5 + | +LL | extern "Rust" fn rust_abi() { + | - possibly return type missing here? +LL | 0 + | ^ expected (), found integer + | + = note: expected type `()` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:54:5 + | +LL | extern "\x43" fn c_abi_escaped() { + | - possibly return type missing here? +LL | 0 + | ^ expected (), found integer + | + = note: expected type `()` + found type `{integer}` + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0308, E0560. For more information about an error, try `rustc --explain E0308`.