-
Notifications
You must be signed in to change notification settings - Fork 28
fix false must_use warning on JoinHandle #78
fix false must_use warning on JoinHandle #78
Conversation
Removes the must_use requirement on the JoinHandle, since it is the result of a future being spawned - thus, the originating future will be polled to completion, whether or not the JoinHandle is polled.
bd8df31
to
c290baf
Compare
I'd recommend replacing it with |
I.e. I'd suggest this: master...stbuehler:replace-joinhandle |
@stbuehler I'm not opposed to that direction at all, but it is worth noting that that behavior is different than how existing runtimes (tokio, namely) currently operate. Do you want to open a PR and perhaps let the maintainers decide which way they want to go? I'm mostly indifferent. |
@rschmukler Done. I'm curious though which part in tokio you mean - I think |
@stbuehler Sorry, I actually remembered the incorrect behavior. Your change is actually very consistent with the |
Reopening per the discussion in #80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks heaps! We'll make this part of the next Runtime release!
Removes the
must_use
requirement on theJoinHandle
Motivation and Context
The
must_use
requirement is a bit misleading, since theJoinHandle
is theresult of a future being spawned, and thus the originating future will be
polled to completion, whether or not the
JoinHandle
is polled.This seems like it may overlap with some of the changes in #73, where it may be desirable to instead use a
RemoteHandle
- but since there is some open discussion, this seems like a worthy (and simple) change.Another option might be to add a
.forget()
method which consumes theJoinHandle
directly, and is thus a bit more explicit.Types of changes