It would be nice if JoinHandle<T> were must-use for T != () #52062
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
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
The text was updated successfully, but these errors were encountered: