Make error message for missing fields with .. and without .. more consistent
This commit is contained in:
parent
ecb170afc8
commit
250b848272
3 changed files with 25 additions and 14 deletions
|
@ -2204,8 +2204,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let fields = listify(&missing_mandatory_fields, |f| format!("`{f}`")).unwrap();
|
||||
self.dcx()
|
||||
.struct_span_err(
|
||||
span.shrink_to_hi(),
|
||||
format!("missing mandatory field{s} {fields}"),
|
||||
span.shrink_to_lo(),
|
||||
format!("missing field{s} {fields} in initializer"),
|
||||
)
|
||||
.with_span_label(
|
||||
span.shrink_to_lo(),
|
||||
"fields that do not have a defaulted value must be provided explicitly",
|
||||
)
|
||||
.emit();
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue