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 of foo::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.
related forum thread
This error message could be more helpful:
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
Selfand suggesting them.related forum thread