Skip to content

Conversation

@WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented Oct 18, 2025

Fixes #65861

r? Nadrieril

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2025

Nadrieril is not on the review rotation at the moment.
They may take a while to respond.

@WaffleLapkin WaffleLapkin added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination L-unused_must_use Lint: unused_must_use labels Oct 18, 2025
@WaffleLapkin
Copy link
Member Author

Lang nomination

This PR changes the unused_must_use lint, such that it doesn't warn if the unused type is Result<T, E> and E is (publicly) uninhabited. Note that it will still warn if T must be used, or the function returning the result is marked as #[must_use].

See the added test: https://github.com/rust-lang/rust/pull/147854/files#diff-13028a2f97ff29d74f6e0e15a8956d73fa02eedb83792612be9ecbe917d8fd8f

@WaffleLapkin WaffleLapkin added the S-waiting-on-t-lang Status: Awaiting decision from T-lang label Oct 18, 2025
@hanna-kruppe
Copy link
Contributor

Unless I misunderstood something, #147382 does basically the same thing

@WaffleLapkin
Copy link
Member Author

@hanna-kruppe ah, yes, for some reason I did not notice it /_=

although weirdly it only suppresses the warning if T = ()...

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2025
@WaffleLapkin WaffleLapkin deleted the never-type-never-worn branch October 18, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination I-lang-nominated Nominated for discussion during a lang team meeting. L-unused_must_use Lint: unused_must_use S-waiting-on-t-lang Status: Awaiting decision from T-lang T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow unused_must_use on result with never type

4 participants