-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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
This error message could be more helpful:
pub mod foo {
pub struct Foo {
you_cant_use_this_field: bool,
}
}
fn main() {
foo::Foo {};
}
error[E0063]: missing field
you_cant_use_this_field
in initializer offoo::Foo
It complains about lack of a private field in the initializer, but this problem can't be solved by adding the field. The implied solution is impossible, and will only lead to another dead-end error.
It would be better to explain in general that this struct can't be constructed from a literal syntax here, because it contains private fields. Bonus points for finding methods that return Self
and suggesting them.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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.