Add name of initializer to missing field message, closes #30299
This commit is contained in:
parent
41a33852b8
commit
15743919dc
@ -3156,12 +3156,13 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
|
||||
!remaining_fields.is_empty()
|
||||
{
|
||||
span_err!(tcx.sess, span, E0063,
|
||||
"missing field{}: {}",
|
||||
"missing field{} {} in initializer of `{}`",
|
||||
if remaining_fields.len() == 1 {""} else {"s"},
|
||||
remaining_fields.keys()
|
||||
.map(|n| format!("`{}`", n))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "));
|
||||
.join(", "),
|
||||
adt_ty);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ struct BuildData {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = BuildData { //~ ERROR missing field: `bar`
|
||||
let foo = BuildData { //~ ERROR missing field `bar` in initializer of `BuildData`
|
||||
foo: 0
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user