about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-07-17 00:15:15 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-07-17 10:21:07 +0300
commit9c5039a128ba2fa69eb979c314f158aa680ff6a2 (patch)
tree3bb41cc6e8bcf8571d5300c2918615fd9434d5af /src/libcore
parent103e5c9b37d6cdc4552b353cdf3fd2772dae760c (diff)
downloadrust-9c5039a128ba2fa69eb979c314f158aa680ff6a2.tar.gz
rust-9c5039a128ba2fa69eb979c314f158aa680ff6a2.zip
Implement traits for variadic function pointers
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ptr.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 8b3a14b24df..925cdfec900 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -571,12 +571,21 @@ macro_rules! fnptr_impls_safety_abi {
 }
 
 macro_rules! fnptr_impls_args {
-    ($($Arg: ident),*) => {
+    ($($Arg: ident),+) => {
         fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
         fnptr_impls_safety_abi! { extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
+        fnptr_impls_safety_abi! { extern "C" fn($($Arg),* , ...) -> Ret, $($Arg),* }
         fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
         fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
-    }
+        fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),* , ...) -> Ret, $($Arg),* }
+    };
+    () => {
+        // No variadic functions with 0 parameters
+        fnptr_impls_safety_abi! { extern "Rust" fn() -> Ret, }
+        fnptr_impls_safety_abi! { extern "C" fn() -> Ret, }
+        fnptr_impls_safety_abi! { unsafe extern "Rust" fn() -> Ret, }
+        fnptr_impls_safety_abi! { unsafe extern "C" fn() -> Ret, }
+    };
 }
 
 fnptr_impls_args! { }