From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/abi/issues/issue-22565-rust-call.rs | 32 +++++++++++++++ .../ui/abi/issues/issue-22565-rust-call.stderr | 26 ++++++++++++ .../abi/issues/issue-62350-sysv-neg-reg-counts.rs | 46 ++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 src/test/ui/abi/issues/issue-22565-rust-call.rs create mode 100644 src/test/ui/abi/issues/issue-22565-rust-call.stderr create mode 100644 src/test/ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs (limited to 'src/test/ui/abi/issues') 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(); + + ::a(); + ::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(); +} -- cgit v1.2.3