From 456ffcdc560c1c7baea116ef1ea03e0f7568102d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 8 Dec 2014 14:30:13 -0800 Subject: Revert "Register new snapshots" This reverts commit 9b443289cf32cbcff16768614340f0c844675340. --- src/libcore/ops.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/libcore') 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 FnOnce for F self.call_mut(args) } } + +#[cfg(stage0)] +mod fn_impls { + use super::Fn; + + impl Fn<(),Result> for extern "Rust" fn() -> Result { + #[allow(non_snake_case)] + extern "rust-call" fn call(&self, _args: ()) -> Result { + (*self)() + } + } + + impl 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 + 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) +} -- cgit 1.4.1-3-g733a5