diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-08 14:30:13 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-08 14:30:13 -0800 |
| commit | 456ffcdc560c1c7baea116ef1ea03e0f7568102d (patch) | |
| tree | 6a028c58f33ce86e16caa405841d5dffcb48725c /src/libcore | |
| parent | 84a7615418749d663d54dd9223a15098b834e2a0 (diff) | |
| download | rust-456ffcdc560c1c7baea116ef1ea03e0f7568102d.tar.gz rust-456ffcdc560c1c7baea116ef1ea03e0f7568102d.zip | |
Revert "Register new snapshots"
This reverts commit 9b443289cf32cbcff16768614340f0c844675340.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/ops.rs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index ce774a66381..fdc8b9e7400 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -832,3 +832,53 @@ impl<F,A,R> FnOnce<A,R> for F self.call_mut(args) } } + +#[cfg(stage0)] +mod fn_impls { + use super::Fn; + + impl<Result> Fn<(),Result> for extern "Rust" fn() -> Result { + #[allow(non_snake_case)] + extern "rust-call" fn call(&self, _args: ()) -> Result { + (*self)() + } + } + + impl<Result,A0> Fn<(A0,),Result> for extern "Rust" fn(A0) -> Result { + #[allow(non_snake_case)] + extern "rust-call" fn call(&self, args: (A0,)) -> Result { + let (a0,) = args; + (*self)(a0) + } + } + + macro_rules! def_fn( + ($($args:ident)*) => ( + impl<Result$(,$args)*> + Fn<($($args,)*),Result> + for extern "Rust" fn($($args: $args,)*) -> Result { + #[allow(non_snake_case)] + extern "rust-call" fn call(&self, args: ($($args,)*)) -> Result { + let ($($args,)*) = args; + (*self)($($args,)*) + } + } + ) + ) + + def_fn!(A0 A1) + def_fn!(A0 A1 A2) + def_fn!(A0 A1 A2 A3) + def_fn!(A0 A1 A2 A3 A4) + def_fn!(A0 A1 A2 A3 A4 A5) + def_fn!(A0 A1 A2 A3 A4 A5 A6) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14) + def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15) +} |
