Give DiagnosticBuilder
a default type.
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
This commit is contained in:
parent
6257f3bf1f
commit
757d6f6ef8
59 changed files with 250 additions and 454 deletions
|
@ -26,8 +26,7 @@ use rustc_ast::{ClosureBinder, MetaItemLit, StmtKind};
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, PResult,
|
||||
StashKey,
|
||||
AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, PResult, StashKey,
|
||||
};
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
|
||||
|
@ -1691,7 +1690,7 @@ impl<'a> Parser<'a> {
|
|||
&self,
|
||||
lifetime: Ident,
|
||||
mk_lit_char: impl FnOnce(Symbol, Span) -> L,
|
||||
err: impl FnOnce(&Self) -> DiagnosticBuilder<'a, ErrorGuaranteed>,
|
||||
err: impl FnOnce(&Self) -> DiagnosticBuilder<'a>,
|
||||
) -> L {
|
||||
if let Some(mut diag) = self.dcx().steal_diagnostic(lifetime.span, StashKey::LifetimeIsChar)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue