Diagnostic misclassifies a complex expression as a unit enum variant when flagging an attempt to call a non-function #99240
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
The current output is:
(it.0.take())
as a (unit) enum variant in both the message and the note which is obviously incorrect.Option<_>
which would've been really helpful. Looking at the current output, it's really hard to see why the expression is not callable.( As an aside, one actual fix for the given code is the following:
it.0.take().unwrap()()
)Link to the playground containing the reproducer, an even smaller reproducer and the original code for context.
I decided to select the slightly larger reproducer (containing the 1-tuple) for this issue instead of the smaller one from the playground (which can probably still be shrunk further) to really highlight the complex expression:
(it.0.take())
over justit.take()
.Reproduces on stable and on nightly.
@rustbot label C-bug D-incorrect D-confusing
The text was updated successfully, but these errors were encountered: