Skip to content

Commit 407e3fd

Browse files
committed
Cleanup
1 parent 91eeb6e commit 407e3fd

3 files changed

Lines changed: 4 additions & 21 deletions

File tree

src/abi_value.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,12 @@ macro_rules! abi_kind_impl {
200200

201201
abi_kind_impl!(AbiValue => {
202202
Rust => "Rust",
203-
204203
C { unwind: false } => "C",
205204
C { unwind: true } => "C-unwind",
206205
System { unwind: false } => "system",
207206
System { unwind: true } => "system-unwind",
208-
209207
Aapcs { unwind: false } => "aapcs",
210208
Aapcs { unwind: true } => "aapcs-unwind",
211-
212209
Cdecl { unwind: false } => "cdecl",
213210
Cdecl { unwind: true } => "cdecl-unwind",
214211
Stdcall { unwind: false } => "stdcall",
@@ -219,7 +216,6 @@ abi_kind_impl!(AbiValue => {
219216
Thiscall { unwind: true } => "thiscall-unwind",
220217
Vectorcall { unwind: false } => "vectorcall",
221218
Vectorcall { unwind: true } => "vectorcall-unwind",
222-
223219
SysV64 { unwind: false } => "sysv64",
224220
SysV64 { unwind: true } => "sysv64-unwind",
225221
Win64 { unwind: false } => "win64",

src/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,4 @@ pub trait UnsafeFnPtr: FnPtr<Safety = Unsafe> {
211211
/// Marker trait for all *static* function pointer types.
212212
/// The return type and all parameter types have to be `'static`.
213213
pub trait StaticFnPtr: FnPtr + 'static {}
214+
impl<F: FnPtr + 'static> StaticFnPtr for F {}

src/impl.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,9 @@ macro_rules! impl_fn {
9797
}
9898
impl_fn!(@impl_safe_fn_type ($($nm : $ty),*), $fn_type, $safety);
9999

100-
#[automatically_derived]
101-
impl<Output: 'static, $($ty: 'static),*> $crate::StaticFnPtr for $fn_type {
102-
}
103-
104100
#[automatically_derived]
105101
impl<Output, $($ty),*> $crate::BuildFn<$crate::safety!($safety), $crate::abi::$abi_ident, Output> for ($($ty,)*) {
106-
type F = impl_fn!(@make_unsafe extern $call_conv fn($($ty),*) -> Output, $safety);
107-
}
108-
};
109-
110-
(@impl_withabi ($($nm:ident : $ty:ident),*), $fn_type:ty, $safety:tt, $abi:tt) => {
111-
#[automatically_derived]
112-
impl<Output, $($ty),*> $crate::WithAbi<$crate::abi!($abi)> for $fn_type {
113-
type F = impl_fn!(@make_unsafe extern $abi fn($($ty),*) -> Output, $safety);
102+
type F = impl_fn!(@make_unsafe extern $call_conv fn($($ty),*) -> Output, $safety);
114103
}
115104
};
116105

@@ -122,22 +111,19 @@ macro_rules! impl_fn {
122111
(@impl_safe_fn_type ($($nm:ident : $ty:ident),*), $fn_type:ty, true) => {
123112
#[automatically_derived]
124113
impl<Output, $($ty),*> $crate::SafeFnPtr for $fn_type {
125-
fn invoke(&self, impl_fn!(@call_args ($($nm),*)): Self::Args) -> Self::Output {
114+
fn invoke(&self, ($($nm,)*): Self::Args) -> Self::Output {
126115
(*self)($($nm),*)
127116
}
128117
}
129118
};
130119
(@impl_safe_fn_type ($($nm:ident : $ty:ident),*), $fn_type:ty, false) => {
131120
#[automatically_derived]
132121
impl<Output, $($ty),*> $crate::UnsafeFnPtr for $fn_type {
133-
unsafe fn invoke(&self, impl_fn!(@call_args ($($nm),*)): Self::Args) -> Self::Output {
122+
unsafe fn invoke(&self, ($($nm,)*): Self::Args) -> Self::Output {
134123
unsafe { (*self)($($nm),*) }
135124
}
136125
}
137126
};
138-
139-
(@call_args ($single:ident)) => { ($single,) };
140-
(@call_args ($($args:ident),*)) => { ($($args),*) };
141127
}
142128

143129
// Default: generate impls up to 6 arguments

0 commit comments

Comments
 (0)