Closed
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.