Skip to content

Commit

Permalink
core: change FutureState Forced(A) to Forced(~A)
Browse files Browse the repository at this point in the history
  • Loading branch information
olsonjeffery authored and brson committed Sep 8, 2012
1 parent 2ed00ff commit 6d84d86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Future<A> {
priv enum FutureState<A> {
Pending(fn~() -> A),
Evaluating,
Forced(A)
Forced(~A)
}

/// Methods on the `future` type
Expand Down Expand Up @@ -75,7 +75,7 @@ fn from_value<A>(+val: A) -> Future<A> {
* not block.
*/

Future {state: Forced(val)}
Future {state: Forced(~val)}
}

fn from_port<A:Send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
Expand Down Expand Up @@ -139,7 +139,7 @@ fn get_ref<A>(future: &r/Future<A>) -> &r/A {

match future.state {
Forced(ref v) => { // v here has type &A, but with a shorter lifetime.
return unsafe{ copy_lifetime(future, v) }; // ...extend it.
return unsafe{ copy_lifetime(future, &**v) }; // ...extend it.
}
Evaluating => {
fail ~"Recursive forcing of future!";
Expand All @@ -154,7 +154,7 @@ fn get_ref<A>(future: &r/Future<A>) -> &r/A {
fail ~"Logic error.";
}
Pending(move f) => {
future.state = Forced(f());
future.state = Forced(~f());
return get_ref(future);
}
}
Expand Down

0 comments on commit 6d84d86

Please sign in to comment.