1
Fork 0

Shorten some error invocations.

- `struct_foo` + `emit` -> `foo`
- `create_foo` + `emit` -> `emit_foo`

I have made recent commits in other PRs that have removed some of these
shortcuts for combinations with few uses, e.g.
`struct_span_err_with_code`. But for the remaining combinations that
have high levels of use, we might as well use them wherever possible.
This commit is contained in:
Nicholas Nethercote 2024-01-04 10:38:10 +11:00
parent 4864cb8aef
commit ff40ad4107
13 changed files with 30 additions and 34 deletions

View file

@ -552,7 +552,7 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>)
sym::simd_shuffle_generic => (2, 1, vec![param(0), param(0)], param(1)),
_ => {
let msg = format!("unrecognized platform-specific intrinsic function: `{name}`");
tcx.dcx().struct_span_err(it.span, msg).emit();
tcx.dcx().span_err(it.span, msg);
return;
}
};

View file

@ -325,7 +325,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
op.is_clobber(),
) {
let msg = format!("cannot use register `{}`: {}", reg.name(), msg);
self.tcx.dcx().struct_span_err(*op_sp, msg).emit();
self.tcx.dcx().span_err(*op_sp, msg);
continue;
}
}
@ -364,7 +364,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
reg_class.name(),
feature
);
self.tcx.dcx().struct_span_err(*op_sp, msg).emit();
self.tcx.dcx().span_err(*op_sp, msg);
// register isn't enabled, don't do more checks
continue;
}
@ -378,7 +378,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
.intersperse(", ")
.collect::<String>(),
);
self.tcx.dcx().struct_span_err(*op_sp, msg).emit();
self.tcx.dcx().span_err(*op_sp, msg);
// register isn't enabled, don't do more checks
continue;
}