-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Terse diagnostic for never type fallback lint warning involving try operator and placeholder in path #132358
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.L-dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.L-dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Compiling the following function warns in Rust 1.81 and later:
I expected it to compile without warnings, as it did with previous Rust versions. It currently produces this warning:
Playground
What is particularly perplexing about this warning is that I don't understand how the never type is even involved, as nothing in the code appears to diverge.
The current workaround is to add
let () = ...before the iteration, which compiles without warnings:While this workaround works, it feels unnecessary and it's hard to explain and justify.