Rename AddToDiagnostic
as Subdiagnostic
.
To match `derive(Subdiagnostic)`. Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
This commit is contained in:
parent
7a294e998b
commit
541d7cc65c
28 changed files with 153 additions and 153 deletions
|
@ -3,8 +3,8 @@ use std::borrow::Cow;
|
|||
use rustc_ast::token::Token;
|
||||
use rustc_ast::{Path, Visibility};
|
||||
use rustc_errors::{
|
||||
codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level,
|
||||
SubdiagMessageOp,
|
||||
codes::*, Applicability, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level,
|
||||
SubdiagMessageOp, Subdiagnostic,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::errors::ExprParenthesesNeeded;
|
||||
|
@ -1093,17 +1093,17 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedIdentifier {
|
|||
diag.arg("token", self.token);
|
||||
|
||||
if let Some(sugg) = self.suggest_raw {
|
||||
sugg.add_to_diagnostic(&mut diag);
|
||||
sugg.add_to_diag(&mut diag);
|
||||
}
|
||||
|
||||
ExpectedIdentifierFound::new(token_descr, self.span).add_to_diagnostic(&mut diag);
|
||||
ExpectedIdentifierFound::new(token_descr, self.span).add_to_diag(&mut diag);
|
||||
|
||||
if let Some(sugg) = self.suggest_remove_comma {
|
||||
sugg.add_to_diagnostic(&mut diag);
|
||||
sugg.add_to_diag(&mut diag);
|
||||
}
|
||||
|
||||
if let Some(help) = self.help_cannot_start_number {
|
||||
help.add_to_diagnostic(&mut diag);
|
||||
help.add_to_diag(&mut diag);
|
||||
}
|
||||
|
||||
diag
|
||||
|
@ -1154,7 +1154,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedSemi {
|
|||
diag.span_label(unexpected_token_label, fluent::parse_label_unexpected_token);
|
||||
}
|
||||
|
||||
self.sugg.add_to_diagnostic(&mut diag);
|
||||
self.sugg.add_to_diag(&mut diag);
|
||||
|
||||
diag
|
||||
}
|
||||
|
@ -1466,8 +1466,8 @@ pub(crate) struct FnTraitMissingParen {
|
|||
pub machine_applicable: bool,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for FnTraitMissingParen {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
impl Subdiagnostic for FnTraitMissingParen {
|
||||
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_: F,
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue