about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-17 01:11:35 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-17 01:11:35 +0300
commit28aec1beaa5e16b17143f993cab408debe1dcda5 (patch)
tree7a52af7e8deeb0f45f55661f6261ed4eb3b8f4c2
parent11580ced403211c8c422a952a2c5dabedf6812d6 (diff)
downloadrust-28aec1beaa5e16b17143f993cab408debe1dcda5.tar.gz
rust-28aec1beaa5e16b17143f993cab408debe1dcda5.zip
Add some more tests
-rw-r--r--src/test/ui/asm/asm-literal-escaping.rs12
-rw-r--r--src/test/ui/proc-macro/span-preservation.rs10
-rw-r--r--src/test/ui/proc-macro/span-preservation.stderr24
3 files changed, 45 insertions, 1 deletions
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 00000000000..8d464e752e6
--- /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 8b8e12fcba6..b22e50c4c17 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 9e9271f529c..545c2fa5f40 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`.