summaryrefslogtreecommitdiffstats
path: root/src/test/ui/abi/issues
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/abi/issues')
-rw-r--r--src/test/ui/abi/issues/issue-22565-rust-call.rs32
-rw-r--r--src/test/ui/abi/issues/issue-22565-rust-call.stderr26
-rw-r--r--src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs46
3 files changed, 104 insertions, 0 deletions
diff --git a/src/test/ui/abi/issues/issue-22565-rust-call.rs b/src/test/ui/abi/issues/issue-22565-rust-call.rs
new file mode 100644
index 000000000..a08e0bfb5
--- /dev/null
+++ b/src/test/ui/abi/issues/issue-22565-rust-call.rs
@@ -0,0 +1,32 @@
+#![feature(unboxed_closures)]
+
+extern "rust-call" fn b(_i: i32) {}
+//~^ ERROR functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+
+trait Tr {
+ extern "rust-call" fn a();
+
+ extern "rust-call" fn b() {}
+ //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
+}
+
+struct Foo;
+
+impl Foo {
+ extern "rust-call" fn bar() {}
+ //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
+}
+
+impl Tr for Foo {
+ extern "rust-call" fn a() {}
+ //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
+}
+
+fn main () {
+ b(10);
+
+ Foo::bar();
+
+ <Foo as Tr>::a();
+ <Foo as Tr>::b();
+}
diff --git a/src/test/ui/abi/issues/issue-22565-rust-call.stderr b/src/test/ui/abi/issues/issue-22565-rust-call.stderr
new file mode 100644
index 000000000..3eee10bc5
--- /dev/null
+++ b/src/test/ui/abi/issues/issue-22565-rust-call.stderr
@@ -0,0 +1,26 @@
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+ --> $DIR/issue-22565-rust-call.rs:3:1
+ |
+LL | extern "rust-call" fn b(_i: i32) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+ --> $DIR/issue-22565-rust-call.rs:9:5
+ |
+LL | extern "rust-call" fn b() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+ --> $DIR/issue-22565-rust-call.rs:16:5
+ |
+LL | extern "rust-call" fn bar() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+ --> $DIR/issue-22565-rust-call.rs:21:5
+ |
+LL | extern "rust-call" fn a() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs b/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs
new file mode 100644
index 000000000..29b240518
--- /dev/null
+++ b/src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs
@@ -0,0 +1,46 @@
+// run-pass
+#![allow(dead_code)]
+#![allow(improper_ctypes)]
+
+// ignore-wasm32-bare no libc to test ffi with
+
+#[derive(Copy, Clone)]
+pub struct QuadFloats {
+ a: f32,
+ b: f32,
+ c: f32,
+ d: f32,
+}
+
+mod rustrt {
+ use super::QuadFloats;
+
+ #[link(name = "rust_test_helpers", kind = "static")]
+ extern "C" {
+ pub fn get_c_exhaust_sysv64_ints(
+ _: *const (),
+ _: *const (),
+ _: *const (),
+ _: *const (),
+ _: *const (),
+ _: *const (),
+ _: *const (),
+ h: QuadFloats,
+ ) -> f32;
+ }
+}
+
+fn test() {
+ unsafe {
+ let null = std::ptr::null();
+ let q = QuadFloats { a: 10.2, b: 20.3, c: 30.4, d: 40.5 };
+ assert_eq!(
+ rustrt::get_c_exhaust_sysv64_ints(null, null, null, null, null, null, null, q),
+ q.c,
+ );
+ }
+}
+
+pub fn main() {
+ test();
+}