Skip to content

Commit 987ef78

Browse files
committed
Fix the test_variadic_ptr fn on printf-less sys
Fixes #36076
1 parent eaf71f8 commit 987ef78

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/libcoretest/ptr.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,16 @@ fn test_unsized_unique() {
173173
}
174174

175175
#[test]
176-
fn test_variadic_fnptr() {
176+
#[allow(warnings)]
177+
// Have a symbol for the test below. It doesn’t need to be an actual variadic function, match the
178+
// ABI, or even point to an actual executable code, because the function itself is never invoked.
179+
#[no_mangle]
180+
pub fn test_variadic_fnptr() {
177181
use core::hash::{Hash, SipHasher};
178-
extern "C" {
179-
fn printf(_: *const u8, ...);
182+
extern {
183+
fn test_variadic_fnptr(_: u64, ...) -> f64;
180184
}
181-
let p: unsafe extern "C" fn(*const u8, ...) = printf;
185+
let p: unsafe extern fn(u64, ...) -> f64 = test_variadic_fnptr;
182186
let q = p.clone();
183187
assert_eq!(p, q);
184188
assert!(!(p < q));

0 commit comments

Comments
 (0)