Closed
Description
Given an invalid call such as:
fn main() {
foo::("foo");
}
The following diagnostic is issued:
error: expected type, found `"foo"`
--> src/main.rs:2:9
|
2 | foo::("foo");
| ^^^^^ expected type
This gets much worse on multiline calls:
fn main() {
foo::(
bar(x, y, z),
bar(x, y, z),
bar(x, y, z),
bar(x, y, z),
bar(x, y, z),
bar(x, y, z),
bar(x, y, z),
baz("test"),
),
}
Which just prints out a diagnostic nowhere near the error:
error: expected type, found `"test"`
--> src/main.rs:10:13
|
10 | baz("test"),
| ^^^^^^ expected type
Ideally this should mention something about either missing a missing turbofish (e.g. foo::<..>("foo")
), or a missing identifier (e.g. foo::bar("foo")
). This would at least get the error pointing to the correct spot.
Latest playground nightly (2024-02-09)
Metadata
Metadata
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTDiagnostics: Confusing error or lint that should be reworked.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.