diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-07-17 00:15:15 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-07-17 10:21:07 +0300 |
| commit | 9c5039a128ba2fa69eb979c314f158aa680ff6a2 (patch) | |
| tree | 3bb41cc6e8bcf8571d5300c2918615fd9434d5af /src/libcore | |
| parent | 103e5c9b37d6cdc4552b353cdf3fd2772dae760c (diff) | |
| download | rust-9c5039a128ba2fa69eb979c314f158aa680ff6a2.tar.gz rust-9c5039a128ba2fa69eb979c314f158aa680ff6a2.zip | |
Implement traits for variadic function pointers
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/ptr.rs | 13 |
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! { } |
