suggest Ok-wrapping for ?
-originating type mismatch when (and only when) applicable
#55429
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Sometimes E0308 on a try-expression can be fixed by wrapping with
Ok
. This is a somewhat common mistake in the form of a?
-expression appearing in tail position of a function that is expected toResult
—However, not all type mismatches on
?
are like this. Here's a negative example—We want to suggest
Ok
-wrapping when that's the correct fix. (This issue is being filed because a previous attempt at this suggestion had too many false positives and is likely to be removed.)See discussion on #52537 for one idea on how to proceed.
The text was updated successfully, but these errors were encountered: