]> git.proxmox.com Git - rustc.git/blobdiff - src/libcoretest/ptr.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / libcoretest / ptr.rs
index e0a9f4e5d422c19f2c617b65132f645e5301c97f..f7fe61896f85e84e03ca00f2c81052a61fe71a31 100644 (file)
@@ -173,12 +173,16 @@ fn test_unsized_unique() {
 }
 
 #[test]
-fn test_variadic_fnptr() {
+#[allow(warnings)]
+// Have a symbol for the test below. It doesn’t need to be an actual variadic function, match the
+// ABI, or even point to an actual executable code, because the function itself is never invoked.
+#[no_mangle]
+pub fn test_variadic_fnptr() {
     use core::hash::{Hash, SipHasher};
-    extern "C" {
-        fn printf(_: *const u8, ...);
+    extern {
+        fn test_variadic_fnptr(_: u64, ...) -> f64;
     }
-    let p: unsafe extern "C" fn(*const u8, ...) = printf;
+    let p: unsafe extern fn(u64, ...) -> f64 = test_variadic_fnptr;
     let q = p.clone();
     assert_eq!(p, q);
     assert!(!(p < q));