diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/abi/compatibility.rs | 30 | ||||
| -rw-r--r-- | tests/ui/abi/issue-94223.rs | 8 | ||||
| -rw-r--r-- | tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs | 30 |
3 files changed, 57 insertions, 11 deletions
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 53e1eff9d72..d5f05313078 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -1,5 +1,14 @@ // check-pass // revisions: host +// revisions: i686 +//[i686] compile-flags: --target i686-unknown-linux-gnu +//[i686] needs-llvm-components: x86 +// revisions: x86-64 +//[x86-64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86-64] needs-llvm-components: x86 +// revisions: x86-64-win +//[x86-64-win] compile-flags: --target x86_64-pc-windows-msvc +//[x86-64-win] needs-llvm-components: x86 // revisions: arm //[arm] compile-flags: --target arm-unknown-linux-gnueabi //[arm] needs-llvm-components: arm @@ -37,9 +46,23 @@ // revisions: wasi //[wasi] compile-flags: --target wasm32-wasi //[wasi] needs-llvm-components: webassembly -// revisions: nvptx64 -//[nvptx64] compile-flags: --target nvptx64-nvidia-cuda -//[nvptx64] needs-llvm-components: nvptx +// revisions: bpf +//[bpf] compile-flags: --target bpfeb-unknown-none +//[bpf] needs-llvm-components: bpf +// revisions: m68k +//[m68k] compile-flags: --target m68k-unknown-linux-gnu +//[m68k] needs-llvm-components: m68k +// FIXME: disabled on nvptx64 since the target ABI fails the sanity check +// see https://github.com/rust-lang/rust/issues/117480 +/* revisions: nvptx64 + [nvptx64] compile-flags: --target nvptx64-nvidia-cuda + [nvptx64] needs-llvm-components: nvptx +*/ +// FIXME: disabled since it fails on CI saying the csky component is missing +/* revisions: csky + [csky] compile-flags: --target csky-unknown-linux-gnuabiv2 + [csky] needs-llvm-components: csky +*/ #![feature(rustc_attrs, unsized_fn_params, transparent_unions)] #![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)] #![allow(unused, improper_ctypes_definitions, internal_features)] @@ -324,6 +347,7 @@ mod unsized_ { use super::*; test_transparent_unsized!(str_, str); test_transparent_unsized!(slice, [u8]); + test_transparent_unsized!(slice_with_prefix, (usize, [u8])); test_transparent_unsized!(dyn_trait, dyn Any); } diff --git a/tests/ui/abi/issue-94223.rs b/tests/ui/abi/issue-94223.rs deleted file mode 100644 index 79d6b94031b..00000000000 --- a/tests/ui/abi/issue-94223.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass -#![allow(improper_ctypes_definitions)] -#![crate_type = "lib"] - -// Check that computing the fn abi for `bad`, with a external ABI fn ptr that is not FFI-safe, does -// not ICE. - -pub fn bad(f: extern "C" fn([u8])) {} diff --git a/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs b/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs new file mode 100644 index 00000000000..a32cc6500f8 --- /dev/null +++ b/tests/ui/abi/unsized-args-in-c-abi-issues-94223-115845.rs @@ -0,0 +1,30 @@ +// check-pass +#![allow(improper_ctypes_definitions)] +#![feature(unsized_tuple_coercion)] +#![feature(unsized_fn_params)] +#![crate_type = "lib"] + +// Check that computing the fn abi for `bad`, with a external ABI fn ptr that is not FFI-safe, does +// not ICE. + +pub fn bad(f: extern "C" fn([u8])) {} + +// While these get accepted, they should also not ICE. +// (If we ever reject them, remove them from this test to ensure the `bad` above +// is still tested. Do *not* make this a check/build-fail test.) + +pub extern "C" fn declare_bad(_x: str) {} + +#[no_mangle] +pub extern "system" fn declare_more_bad(f: dyn FnOnce()) { +} + +fn make_bad() -> extern "C" fn(([u8],)) { + todo!() +} + +pub fn call_bad() { + let f = make_bad(); + let slice: Box<([u8],)> = Box::new(([1; 8],)); + f(*slice); +} |
