Skip to content

Commit a78c911

Browse files
committed
add foreign-vectorcall test
1 parent dfcd0db commit a78c911

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Make the aux build not use `dylib` to avoid https://github.com/rust-lang/rust/issues/130196
2+
//@ no-prefer-dynamic
3+
#![feature(abi_vectorcall)]
4+
#![crate_type = "lib"]
5+
6+
#[no_mangle]
7+
#[inline(never)]
8+
pub extern "vectorcall" fn call_with_42(i: i32) {
9+
assert_eq!(i, 42);
10+
}

tests/ui/extern/extern-vectorcall.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
//@ run-pass
2+
//@ aux-build:foreign-vectorcall.rs
23
//@ revisions: x64 x32
34
//@ [x64]only-x86_64
45
//@ [x32]only-x86
56

67
#![feature(abi_vectorcall)]
78

9+
extern crate foreign_vectorcall;
10+
11+
// Import this as a foreign function, that's the code path we are interested in
12+
// (LLVM has to do some name mangling here).
13+
extern "vectorcall" {
14+
fn call_with_42(i: i32);
15+
}
16+
817
trait A {
918
extern "vectorcall" fn test1(i: i32);
1019
}
@@ -24,4 +33,5 @@ extern "vectorcall" fn test2(i: i32) {
2433
fn main() {
2534
<S as A>::test1(1);
2635
test2(2);
36+
unsafe { call_with_42(42) };
2737
}

0 commit comments

Comments
 (0)