summary refs log tree commit diff
path: root/src/libstd/thunk.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
commitdfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (patch)
treee9c32f2e58b3462a23dd9c472d2f236640b78811 /src/libstd/thunk.rs
parent6c065fc8cb036785f61ff03e05c1563cbb2dd081 (diff)
parent47f91a9484eceef10536d4caac6ef578cd254567 (diff)
downloadrust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.tar.gz
rust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.zip
Manual merge of #22475 - alexcrichton:rollup, r=alexcrichton
 One windows bot failed spuriously.
Diffstat (limited to 'src/libstd/thunk.rs')
-rw-r--r--src/libstd/thunk.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs
index 0831242f954..fe39954f0d4 100644
--- a/src/libstd/thunk.rs
+++ b/src/libstd/thunk.rs
@@ -16,21 +16,24 @@ use alloc::boxed::Box;
 use core::marker::Send;
 use core::ops::FnOnce;
 
-pub struct Thunk<A=(),R=()> {
-    invoke: Box<Invoke<A,R>+Send>
+pub struct Thunk<'a, A=(),R=()> {
+    #[cfg(stage0)]
+    invoke: Box<Invoke<A,R>+Send>,
+    #[cfg(not(stage0))]
+    invoke: Box<Invoke<A,R>+Send + 'a>,
 }
 
-impl<R> Thunk<(),R> {
-    pub fn new<F>(func: F) -> Thunk<(),R>
-        where F : FnOnce() -> R, F : Send
+impl<'a, R> Thunk<'a,(),R> {
+    pub fn new<F>(func: F) -> Thunk<'a,(),R>
+        where F : FnOnce() -> R, F : Send + 'a
     {
         Thunk::with_arg(move|()| func())
     }
 }
 
-impl<A,R> Thunk<A,R> {
-    pub fn with_arg<F>(func: F) -> Thunk<A,R>
-        where F : FnOnce(A) -> R, F : Send
+impl<'a,A,R> Thunk<'a,A,R> {
+    pub fn with_arg<F>(func: F) -> Thunk<'a,A,R>
+        where F : FnOnce(A) -> R, F : Send + 'a
     {
         Thunk {
             invoke: box func