Skip to content

Commit 3589798

Browse files
committed
add regression test
1 parent eaaa03f commit 3589798

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

tests/ui/abi/issue-94223.rs

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// check-pass
2+
#![allow(improper_ctypes_definitions)]
3+
#![feature(unsized_tuple_coercion)]
4+
#![feature(unsized_fn_params)]
5+
#![crate_type = "lib"]
6+
7+
// Check that computing the fn abi for `bad`, with a external ABI fn ptr that is not FFI-safe, does
8+
// not ICE.
9+
10+
pub fn bad(f: extern "C" fn([u8])) {}
11+
12+
// While these get accepted, they should also not ICE.
13+
// (If we ever reject them, remove them from this test to ensure the `bad` above
14+
// is still tested. Do *not* make this a check/build-fail test.)
15+
16+
pub extern "C" fn declare_bad(_x: str) {}
17+
18+
#[no_mangle]
19+
pub extern "system" fn declare_more_bad(f: dyn FnOnce()) {
20+
}
21+
22+
fn make_bad() -> extern "C" fn(([u8],)) {
23+
todo!()
24+
}
25+
26+
pub fn call_bad() {
27+
let f = make_bad();
28+
let slice: Box<([u8],)> = Box::new(([1; 8],));
29+
f(*slice);
30+
}

0 commit comments

Comments
 (0)