diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-04-01 11:12:30 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-04-01 14:41:21 -0400 |
| commit | cade32acf6f5ff209ee082d70350d9bc0362985a (patch) | |
| tree | 79c4fd475c0b8e9f75972eb505800399025fba06 /src/liballoc | |
| parent | ed63d32651105e56afceb94cbb86f115db235825 (diff) | |
| download | rust-cade32acf6f5ff209ee082d70350d9bc0362985a.tar.gz rust-cade32acf6f5ff209ee082d70350d9bc0362985a.zip | |
Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias
for `Box<FnBox()>`. 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)`.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 12 |
1 files changed, 4 insertions, 8 deletions
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<Error + Send + 'a> { /// } /// } /// ``` -#[cfg(not(stage0))] #[rustc_paren_sugar] #[unstable(feature = "core", reason = "Newly introduced")] pub trait FnBox<A> { type Output; - extern "rust-call" fn call_box(self: Box<Self>, args: A) -> Self::Output; + fn call_box(self: Box<Self>, args: A) -> Self::Output; } -#[cfg(not(stage0))] impl<A,F> FnBox<A> for F where F: FnOnce<A> { type Output = F::Output; - extern "rust-call" fn call_box(self: Box<F>, args: A) -> F::Output { + fn call_box(self: Box<F>, args: A) -> F::Output { self.call_once(args) } } -#[cfg(not(stage0))] -impl<A,R> FnOnce<A> for Box<FnBox<A,Output=R>> { +impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+'a> { type Output = R; extern "rust-call" fn call_once(self, args: A) -> R { @@ -422,8 +419,7 @@ impl<A,R> FnOnce<A> for Box<FnBox<A,Output=R>> { } } -#[cfg(not(stage0))] -impl<A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send> { +impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send+'a> { type Output = R; extern "rust-call" fn call_once(self, args: A) -> R { |
