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
|
@ -32,7 +32,7 @@ use rustc_ast::{HasAttrs, HasTokens, Unsafe, Visibility, VisibilityKind};
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::PResult;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError, MultiSpan};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, FatalError, MultiSpan};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -908,7 +908,7 @@ impl<'a> Parser<'a> {
|
|||
fn recover_missing_braces_around_closure_body(
|
||||
&mut self,
|
||||
closure_spans: ClosureSpans,
|
||||
mut expect_err: DiagnosticBuilder<'_, ErrorGuaranteed>,
|
||||
mut expect_err: DiagnosticBuilder<'_>,
|
||||
) -> PResult<'a, ()> {
|
||||
let initial_semicolon = self.token.span;
|
||||
|
||||
|
@ -1490,7 +1490,7 @@ impl<'a> Parser<'a> {
|
|||
pub(crate) fn make_unclosed_delims_error(
|
||||
unmatched: UnmatchedDelim,
|
||||
sess: &ParseSess,
|
||||
) -> Option<DiagnosticBuilder<'_, ErrorGuaranteed>> {
|
||||
) -> Option<DiagnosticBuilder<'_>> {
|
||||
// `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to
|
||||
// `unmatched_delims` only for error recovery in the `Parser`.
|
||||
let found_delim = unmatched.found_delim?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue