Error message for "expression ascription" does not highlight the entire expression #43703
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The parsing of Rust source code to an AST
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
WG-diagnostics
Working group: Diagnostics
This came up in #rust today and I couldn't find any similar A-diagnostics issues. A simple example is:
This correctly fails with a compiler error, since it's using
:
for type ascription where it meant to use=
for initialization. But our current error message makes it sound like the problem is near10
, instead of near the:
.Ideally the message would be "expected type, found
Vec::with_capacity(10)
".The text was updated successfully, but these errors were encountered: