error missing-field
What it means#
A literal T{ ... } MUST give a value to every field that has no default value (§4.3). Fields with defaults, and fields taken from a base with ..base, may be omitted.
Example#
data User {
id: u64
name: str
}
fn main() {
let u = User{ id: 1 } // <- missing-field (name)
}error
missing-field
How to fix#
data User {
id: u64
name: str
}
fn main() {
let u = User{ id: 1, name: "Ann" }
}Provide the missing field, give it a default in the declaration (name: str = ""), or spread from an existing value with ..base.