1
Fork 0

Avoid struct_diagnostic where possible.

It's necessary for `derive(Diagnostic)`, but is best avoided elsewhere
because there are clearer alternatives.

This required adding `Handler::struct_almost_fatal`.
This commit is contained in:
Nicholas Nethercote 2023-12-13 15:19:34 +11:00
parent dc05a30996
commit 7bdb227567
7 changed files with 26 additions and 19 deletions

View file

@ -19,7 +19,7 @@ impl<'a> IntoDiagnostic<'a> for FeatureGateError {
self,
handler: &'a rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut diag = handler.struct_diagnostic(self.explain);
let mut diag = handler.struct_err(self.explain);
diag.set_span(self.span);
diag.code(error_code!(E0658));
diag