-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove a box from future, and add future::unwrap #4020
Conversation
The removal of the box seems ... safe-ish to me. Or rather, it seems like it is as safe as the existing code. But that existing pattern looks to me like it becomes unsafe if you add an unwrap() call. Specifically, |
Oh. There's already |
Hm Hm! The more I think about this the more unusual it seems. What's the point of a future that resets itself? You can only read it once, it's equivalent to a port. Also, you're not resetting it here, you're setting it to |
(Reopening...) I still think this could be pretty useful, it would in effect be a one-shot #4023 is related. |
FWIW, this change looks safe to me. |
I agree |
I wasn't aware of |
The difference is that futures contain a value and pipes produce a value, but they are very similar (and I think the preferred way to create a future now is probably from a oneshot pipe, which also incidentally acts as a 'promise' - if nobody sends the Future value then requesting the value fails). I do think they have different use cases. The thing that is making Futures unuseful to me is that they are not Const. For the things where I need futures the most I need them to be sharable. Conceptually I need an |
… to Tm and Tm_. Not entirely clear what the best way to do this is. Right now we persist the entire struct which seems to be both portable and exactly round-trippable.
This avoids rust-lang#4044 by not using the enum wrapper, and turning Tm_ directly into a struct. Along the way it modernizes the codebase to eliminate no-implicit-copies warnings.
Nope, closing. |
pthread-sync test: use thread::scope for more reliable thread scoping
pthread-sync test: use thread::scope for more reliable thread scoping
This patch removes the box that holds the forced value, which seems unnecessary to me now that moves work well. Along with that I added a way to unwrap the forced value to match
option
andresult
.The one change I'm not positive about is erickt@ae8253c#L0L140. @nikomatsakis: Your name is attached to this change. Does this look right?