-
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
Unused results lint fails on trivial program #43806
Comments
Bisected to #43728, cc @zackmdavis, @eddyb |
Every function call, even those returning #![deny(unused_results)]
fn g() {}
fn main() {
g(); //~ ERROR unused result
} |
I would like to work on this if no one else wants to. |
I see. During #43728, I put the new ununsed-for-functions code after the existing unused-must-use code but before the unused-results check, and modified the unused-must-use code to not return early for types that couldn't be results (including, notably, 😰 😢 😞 Sorry, I can submit a fix this afternoon. Thanks for the report, @aepsil0n. |
@pengowen123 I think I'm morally obligated to do everything in my power to minimize the number of nightlies that are contaminated with my mistake, so I should probably take this unless you're really enthusiastic about fixing it today? |
@zackmdavis I should be able to fix it today. Don't worry about it being your mistake, I will work on it. |
@pengowen123 Works for me. I think returning early before the unused-results check if |
This is being fixed in #43813 |
Fix unused_result lint triggering when a function returns `()`, `!` or an empty enum Also added a test to prevent this from happening again. Fixes #43806
This is still broken for functions returning structs or non-empty enums. I am working on fixing this. EDIT: Nevermind, this is intended behavior. |
See also #44119. It seems the |
The
unused_results
lint appears to be somewhat overzealous on the current nightly compiler. I managed to reduce the issue down to a simple hello world-program, so something is definitely broken.I tried this code:
I expected to see the code compile successfully without any warnings.
Instead, the following error message showed up.
Meta
The text was updated successfully, but these errors were encountered: