Rename AddToDiagnostic as Subdiagnostic.

To match `derive(Subdiagnostic)`.

Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
This commit is contained in:
Nicholas Nethercote
2024-03-06 14:00:16 +11:00
parent 7a294e998b
commit 541d7cc65c
28 changed files with 153 additions and 153 deletions

View File

@@ -36,8 +36,8 @@ use rustc_ast::{
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{
pluralize, AddToDiagnostic, Applicability, Diag, DiagCtxt, ErrorGuaranteed, FatalError, PErr,
PResult,
pluralize, Applicability, Diag, DiagCtxt, ErrorGuaranteed, FatalError, PErr, PResult,
Subdiagnostic,
};
use rustc_session::errors::ExprParenthesesNeeded;
use rustc_span::source_map::Spanned;
@@ -1271,7 +1271,7 @@ impl<'a> Parser<'a> {
Ok(_) => {
if self.token == token::Eq {
let sugg = SuggAddMissingLetStmt { span: prev_span };
sugg.add_to_diagnostic(err);
sugg.add_to_diag(err);
}
}
Err(e) => {

View File

@@ -27,7 +27,7 @@ use rustc_ast::{Arm, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLim
use rustc_ast::{ClosureBinder, MetaItemLit, StmtKind};
use rustc_ast_pretty::pprust;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_errors::{AddToDiagnostic, Applicability, Diag, PResult, StashKey};
use rustc_errors::{Applicability, Diag, PResult, StashKey, Subdiagnostic};
use rustc_lexer::unescape::unescape_char;
use rustc_macros::Subdiagnostic;
use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
@@ -3451,8 +3451,8 @@ impl<'a> Parser<'a> {
let in_if_guard = self.restrictions.contains(Restrictions::IN_IF_GUARD);
let async_block_err = |e: &mut Diag<'_>, span: Span| {
errors::AsyncBlockIn2015 { span }.add_to_diagnostic(e);
errors::HelpUseLatestEdition::new().add_to_diagnostic(e);
errors::AsyncBlockIn2015 { span }.add_to_diag(e);
errors::HelpUseLatestEdition::new().add_to_diag(e);
};
while self.token != token::CloseDelim(close_delim) {