Skip to content

Commit ed4688c

Browse files
committed
Fix the test to use explicit argument types
Hopefully this pacifies the 32bit windows. Apparently there’s an ABI out there that not only allows non-64 bit variadic arguments, but also has differing ABI for them! Good thing all variadic functions are unsafe.
1 parent f181187 commit ed4688c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/test/run-pass/variadic-ffi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#[link(name = "rust_test_helpers")]
1212
extern {
13-
fn rust_interesting_average(_: i64, ...) -> f64;
13+
fn rust_interesting_average(_: u64, ...) -> f64;
1414
}
1515

1616
pub fn main() {
@@ -21,26 +21,26 @@ pub fn main() {
2121

2222
// Call with direct arguments
2323
unsafe {
24-
assert_eq!(rust_interesting_average(1, 10, 10.0) as i64, 20);
24+
assert_eq!(rust_interesting_average(1, 10i64, 10.0f64) as i64, 20);
2525
}
2626

2727
// Call with named arguments, variable number of them
28-
let (x1, x2, x3, x4) = (10, 10.0, 20, 20.0);
28+
let (x1, x2, x3, x4) = (10i64, 10.0f64, 20i64, 20.0f64);
2929
unsafe {
3030
assert_eq!(rust_interesting_average(2, x1, x2, x3, x4) as i64, 30);
3131
}
3232

3333
// A function that takes a function pointer
34-
unsafe fn call(fp: unsafe extern fn(i64, ...) -> f64) {
35-
let (x1, x2, x3, x4) = (10, 10.0, 20, 20.0);
34+
unsafe fn call(fp: unsafe extern fn(u64, ...) -> f64) {
35+
let (x1, x2, x3, x4) = (10i64, 10.0f64, 20i64, 20.0f64);
3636
assert_eq!(fp(2, x1, x2, x3, x4) as i64, 30);
3737
}
3838

3939
unsafe {
4040
call(rust_interesting_average);
4141

4242
// Make a function pointer, pass indirectly
43-
let x: unsafe extern fn(i64, ...) -> f64 = rust_interesting_average;
43+
let x: unsafe extern fn(u64, ...) -> f64 = rust_interesting_average;
4444
call(x);
4545
}
4646
}

0 commit comments

Comments
 (0)