-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.F-type_ascription`#![feature(type_ascription)]``#![feature(type_ascription)]`T-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.
Description
Given this code, where a path separator is typoed as a single instead of double colon:
struct Foo { a: () }
fn main() {
Foo:new();
}
the compiler currently outputs:
error[E0423]: expected value, found struct `Foo`
--> src/main.rs:4:5
|
1 | struct Foo { a: () }
| -------------------- `Foo` defined here
...
4 | Foo:new();
| ^^^ help: use struct literal syntax instead: `Foo { a: val }`
error[E0412]: cannot find type `new` in this scope
--> src/main.rs:4:9
|
4 | Foo:new();
| -^^^ not found in this scope
| |
| help: maybe you meant to write a path separator here: `::`
This output is quite decent already: the second diagnostic correctly identifies that I meant to write a path separator and suggests a fix. However, before I read the second diagnostic, I naturally read the first diagnostic, which is entirely unhelpful. It would be better if the suggestion could be on the first diagnostic, or if the diagnostics could be combined in some way.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.F-type_ascription`#![feature(type_ascription)]``#![feature(type_ascription)]`T-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.