From cade32acf6f5ff209ee082d70350d9bc0362985a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 1 Apr 2015 11:12:30 -0400 Subject: Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias for `Box`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`. --- src/liballoc/boxed.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 8d3a63ceb50..8e3be7dd05b 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -393,28 +393,25 @@ impl<'a, 'b> From<&'b str> for Box { /// } /// } /// ``` -#[cfg(not(stage0))] #[rustc_paren_sugar] #[unstable(feature = "core", reason = "Newly introduced")] pub trait FnBox { type Output; - extern "rust-call" fn call_box(self: Box, args: A) -> Self::Output; + fn call_box(self: Box, args: A) -> Self::Output; } -#[cfg(not(stage0))] impl FnBox for F where F: FnOnce { type Output = F::Output; - extern "rust-call" fn call_box(self: Box, args: A) -> F::Output { + fn call_box(self: Box, args: A) -> F::Output { self.call_once(args) } } -#[cfg(not(stage0))] -impl FnOnce for Box> { +impl<'a,A,R> FnOnce for Box+'a> { type Output = R; extern "rust-call" fn call_once(self, args: A) -> R { @@ -422,8 +419,7 @@ impl FnOnce for Box> { } } -#[cfg(not(stage0))] -impl FnOnce for Box+Send> { +impl<'a,A,R> FnOnce for Box+Send+'a> { type Output = R; extern "rust-call" fn call_once(self, args: A) -> R { -- cgit 1.4.1-3-g733a5