core: change FutureState Forced(A) to Forced(~A)
This commit is contained in:
parent
2ed00ff928
commit
6d84d86736
1 changed files with 4 additions and 4 deletions
|
@ -43,7 +43,7 @@ struct Future<A> {
|
||||||
priv enum FutureState<A> {
|
priv enum FutureState<A> {
|
||||||
Pending(fn~() -> A),
|
Pending(fn~() -> A),
|
||||||
Evaluating,
|
Evaluating,
|
||||||
Forced(A)
|
Forced(~A)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Methods on the `future` type
|
/// Methods on the `future` type
|
||||||
|
@ -75,7 +75,7 @@ fn from_value<A>(+val: A) -> Future<A> {
|
||||||
* not block.
|
* not block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Future {state: Forced(val)}
|
Future {state: Forced(~val)}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_port<A:Send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
|
fn from_port<A:Send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
|
||||||
|
@ -139,7 +139,7 @@ fn get_ref<A>(future: &r/Future<A>) -> &r/A {
|
||||||
|
|
||||||
match future.state {
|
match future.state {
|
||||||
Forced(ref v) => { // v here has type &A, but with a shorter lifetime.
|
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 => {
|
Evaluating => {
|
||||||
fail ~"Recursive forcing of future!";
|
fail ~"Recursive forcing of future!";
|
||||||
|
@ -154,7 +154,7 @@ fn get_ref<A>(future: &r/Future<A>) -> &r/A {
|
||||||
fail ~"Logic error.";
|
fail ~"Logic error.";
|
||||||
}
|
}
|
||||||
Pending(move f) => {
|
Pending(move f) => {
|
||||||
future.state = Forced(f());
|
future.state = Forced(~f());
|
||||||
return get_ref(future);
|
return get_ref(future);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue