Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIt would be nice if JoinHandle<T> were must-use for T != () #52062
Comments
Mark-Simulacrum
added
A-diagnostics
T-libs
T-compiler
C-feature-request
labels
Jul 7, 2018
This comment has been minimized.
This comment has been minimized.
|
This looks like #48820, which was closed. |
This comment has been minimized.
This comment has been minimized.
jscinoz
commented
Jan 14, 2019
|
I think this is subtly different - #48820 was for |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scottmcm commentedJul 4, 2018
One IRC today, someone had code not working because they were doing
Which of course returns the function rather than running it.
Arguably it's almost always mistake to not keep the JoinHandle if the thread is going to return a non-unit value, since if you didn't care the closure could just be
-> (), so this should lint, but AFAIK#[must_use]on the function or type would warn forJoinHandle<()>too today.Repro link: https://play.rust-lang.org/?gist=fd8973579bf0bf474a7e2b9e135ff946&version=nightly