Skip to content

Commit a61fb00

Browse files
committed
Auto merge of rust-lang#121780 - nnethercote:diag-renaming2, r=davidtwco
Diagnostic renaming 2 A sequel to rust-lang#121489. r? `@davidtwco`
2 parents d18480b + bbd1242 commit a61fb00

File tree

94 files changed

+601
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+601
-632
lines changed

compiler/rustc_ast_lowering/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_errors::{
2-
codes::*, AddToDiagnostic, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagnosticMessageOp,
2+
codes::*, AddToDiagnostic, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp,
33
};
44
use rustc_macros::{Diagnostic, Subdiagnostic};
55
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -41,7 +41,7 @@ pub struct InvalidAbi {
4141
pub struct InvalidAbiReason(pub &'static str);
4242

4343
impl AddToDiagnostic for InvalidAbiReason {
44-
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
44+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
4545
self,
4646
diag: &mut Diag<'_, G>,
4747
_: F,

compiler/rustc_ast_passes/src/ast_validation.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_parse::validate_attr;
1818
use rustc_session::lint::builtin::{
1919
DEPRECATED_WHERE_CLAUSE_LOCATION, MISSING_ABI, PATTERNS_IN_FNS_WITHOUT_BODY,
2020
};
21-
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
21+
use rustc_session::lint::{BuiltinLintDiag, LintBuffer};
2222
use rustc_session::Session;
2323
use rustc_span::symbol::{kw, sym, Ident};
2424
use rustc_span::Span;
@@ -750,7 +750,7 @@ impl<'a> AstValidator<'a> {
750750
id,
751751
span,
752752
fluent::ast_passes_extern_without_abi,
753-
BuiltinLintDiagnostics::MissingAbi(span, abi::Abi::FALLBACK),
753+
BuiltinLintDiag::MissingAbi(span, abi::Abi::FALLBACK),
754754
)
755755
}
756756
}
@@ -1408,7 +1408,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
14081408
FnCtxt::Foreign => fluent::ast_passes_pattern_in_foreign,
14091409
_ => fluent::ast_passes_pattern_in_bodiless,
14101410
};
1411-
let diag = BuiltinLintDiagnostics::PatternsInFnsWithoutBody(span, ident);
1411+
let diag = BuiltinLintDiag::PatternsInFnsWithoutBody(span, ident);
14121412
self.lint_buffer.buffer_lint_with_diagnostic(
14131413
PATTERNS_IN_FNS_WITHOUT_BODY,
14141414
id,
@@ -1491,7 +1491,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
14911491
item.id,
14921492
err.span,
14931493
fluent::ast_passes_deprecated_where_clause_location,
1494-
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(sugg),
1494+
BuiltinLintDiag::DeprecatedWhereclauseLocation(sugg),
14951495
);
14961496
}
14971497

compiler/rustc_ast_passes/src/errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use rustc_ast::ParamKindOrd;
44
use rustc_errors::{
5-
codes::*, AddToDiagnostic, Applicability, Diag, EmissionGuarantee, SubdiagnosticMessageOp,
5+
codes::*, AddToDiagnostic, Applicability, Diag, EmissionGuarantee, SubdiagMessageOp,
66
};
77
use rustc_macros::{Diagnostic, Subdiagnostic};
88
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -374,7 +374,7 @@ pub struct EmptyLabelManySpans(pub Vec<Span>);
374374

375375
// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
376376
impl AddToDiagnostic for EmptyLabelManySpans {
377-
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
377+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
378378
self,
379379
diag: &mut Diag<'_, G>,
380380
_: F,
@@ -743,7 +743,7 @@ pub struct StableFeature {
743743
}
744744

745745
impl AddToDiagnostic for StableFeature {
746-
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
746+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
747747
self,
748748
diag: &mut Diag<'_, G>,
749749
_: F,

compiler/rustc_attr/src/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg};
88
use rustc_macros::HashStable_Generic;
99
use rustc_session::config::ExpectedValues;
1010
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
11-
use rustc_session::lint::BuiltinLintDiagnostics;
11+
use rustc_session::lint::BuiltinLintDiag;
1212
use rustc_session::parse::feature_err;
1313
use rustc_session::{RustcVersion, Session};
1414
use rustc_span::hygiene::Transparency;
@@ -535,7 +535,7 @@ pub fn cfg_matches(
535535
} else {
536536
format!("unexpected `cfg` condition value: (none)")
537537
},
538-
BuiltinLintDiagnostics::UnexpectedCfgValue(
538+
BuiltinLintDiag::UnexpectedCfgValue(
539539
(cfg.name, cfg.name_span),
540540
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
541541
),
@@ -547,7 +547,7 @@ pub fn cfg_matches(
547547
cfg.span,
548548
lint_node_id,
549549
format!("unexpected `cfg` condition name: `{}`", cfg.name),
550-
BuiltinLintDiagnostics::UnexpectedCfgName(
550+
BuiltinLintDiag::UnexpectedCfgName(
551551
(cfg.name, cfg.name_span),
552552
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
553553
),

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1603,18 +1603,19 @@ impl<'a> TraitDef<'a> {
16031603
// Once use of `icu4x-0.9.0` has dropped sufficiently, this
16041604
// exception should be removed.
16051605
let is_simple_path = |ty: &P<ast::Ty>, sym| {
1606-
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind &&
1607-
let [seg] = segments.as_slice() &&
1608-
seg.ident.name == sym && seg.args.is_none()
1606+
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind
1607+
&& let [seg] = segments.as_slice()
1608+
&& seg.ident.name == sym
1609+
&& seg.args.is_none()
16091610
{
16101611
true
16111612
} else {
16121613
false
16131614
}
16141615
};
16151616

1616-
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind &&
1617-
is_simple_path(ty, sym::u8)
1617+
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind
1618+
&& is_simple_path(ty, sym::u8)
16181619
{
16191620
Some("byte")
16201621
} else if is_simple_path(&struct_field.ty, sym::str) {
@@ -1631,7 +1632,7 @@ impl<'a> TraitDef<'a> {
16311632
format!(
16321633
"{ty} slice in a packed struct that derives a built-in trait"
16331634
),
1634-
rustc_lint_defs::BuiltinLintDiagnostics::ByteSliceInPackedStructWithDerive
1635+
rustc_lint_defs::BuiltinLintDiag::ByteSliceInPackedStructWithDerive,
16351636
);
16361637
} else {
16371638
// Wrap the expression in `{...}`, causing a copy.

compiler/rustc_builtin_macros/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_errors::{
22
codes::*, AddToDiagnostic, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
3-
SingleLabelManySpans, SubdiagnosticMessageOp,
3+
SingleLabelManySpans, SubdiagMessageOp,
44
};
55
use rustc_macros::{Diagnostic, Subdiagnostic};
66
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -590,7 +590,7 @@ pub(crate) struct FormatUnusedArg {
590590
// Allow the singular form to be a subdiagnostic of the multiple-unused
591591
// form of diagnostic.
592592
impl AddToDiagnostic for FormatUnusedArg {
593-
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
593+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
594594
self,
595595
diag: &mut Diag<'_, G>,
596596
f: F,

compiler/rustc_builtin_macros/src/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_span::symbol::{Ident, Symbol};
1616
use rustc_span::{BytePos, ErrorGuaranteed, InnerSpan, Span};
1717

1818
use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY;
19-
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, LintId};
19+
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiag, LintId};
2020

2121
// The format_args!() macro is expanded in three steps:
2222
// 1. First, `parse_args` will parse the `(literal, arg, arg, name=arg, name=arg)` syntax,
@@ -553,7 +553,7 @@ fn make_format_args(
553553
msg: format!("named argument `{}` is not used by name", arg_name.name).into(),
554554
node_id: rustc_ast::CRATE_NODE_ID,
555555
lint_id: LintId::of(NAMED_ARGUMENTS_USED_POSITIONALLY),
556-
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
556+
diagnostic: BuiltinLintDiag::NamedArgumentUsedPositionally {
557557
position_sp_to_replace,
558558
position_sp_for_msg,
559559
named_arg_sp: arg_name.span,

compiler/rustc_codegen_ssa/src/back/write.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_data_structures::sync::Lrc;
1616
use rustc_errors::emitter::Emitter;
1717
use rustc_errors::translation::Translate;
1818
use rustc_errors::{
19-
Diag, DiagArgMap, DiagCtxt, DiagnosticMessage, ErrCode, FatalError, FluentBundle, Level,
20-
MultiSpan, Style,
19+
Diag, DiagArgMap, DiagCtxt, DiagMessage, ErrCode, FatalError, FluentBundle, Level, MultiSpan,
20+
Style,
2121
};
2222
use rustc_fs_util::link_or_copy;
2323
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
@@ -1004,9 +1004,9 @@ pub(crate) enum Message<B: WriteBackendMethods> {
10041004
/// process another codegen unit.
10051005
pub struct CguMessage;
10061006

1007-
// A cut-down version of `rustc_errors::Diagnostic` that impls `Send`, which
1007+
// A cut-down version of `rustc_errors::DiagInner` that impls `Send`, which
10081008
// can be used to send diagnostics from codegen threads to the main thread.
1009-
// It's missing the following fields from `rustc_errors::Diagnostic`.
1009+
// It's missing the following fields from `rustc_errors::DiagInner`.
10101010
// - `span`: it doesn't impl `Send`.
10111011
// - `suggestions`: it doesn't impl `Send`, and isn't used for codegen
10121012
// diagnostics.
@@ -1015,18 +1015,18 @@ pub struct CguMessage;
10151015
// - `emitted_at`: not used for codegen diagnostics.
10161016
struct Diagnostic {
10171017
level: Level,
1018-
messages: Vec<(DiagnosticMessage, Style)>,
1018+
messages: Vec<(DiagMessage, Style)>,
10191019
code: Option<ErrCode>,
10201020
children: Vec<Subdiagnostic>,
10211021
args: DiagArgMap,
10221022
}
10231023

1024-
// A cut-down version of `rustc_errors::SubDiagnostic` that impls `Send`. It's
1025-
// missing the following fields from `rustc_errors::SubDiagnostic`.
1024+
// A cut-down version of `rustc_errors::Subdiag` that impls `Send`. It's
1025+
// missing the following fields from `rustc_errors::Subdiag`.
10261026
// - `span`: it doesn't impl `Send`.
10271027
pub struct Subdiagnostic {
10281028
level: Level,
1029-
messages: Vec<(DiagnosticMessage, Style)>,
1029+
messages: Vec<(DiagMessage, Style)>,
10301030
}
10311031

10321032
#[derive(PartialEq, Clone, Copy, Debug)]

compiler/rustc_const_eval/src/const_eval/error.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::mem;
22

3-
use rustc_errors::{
4-
DiagArgName, DiagArgValue, DiagnosticMessage, IntoDiagnostic, IntoDiagnosticArg,
5-
};
3+
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, IntoDiagnostic, IntoDiagnosticArg};
64
use rustc_hir::CRATE_HIR_ID;
75
use rustc_middle::mir::AssertKind;
86
use rustc_middle::query::TyCtxtAt;
@@ -25,7 +23,7 @@ pub enum ConstEvalErrKind {
2523
}
2624

2725
impl MachineStopType for ConstEvalErrKind {
28-
fn diagnostic_message(&self) -> DiagnosticMessage {
26+
fn diagnostic_message(&self) -> DiagMessage {
2927
use crate::fluent_generated::*;
3028
use ConstEvalErrKind::*;
3129
match self {

compiler/rustc_const_eval/src/errors.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::borrow::Cow;
22

33
use rustc_errors::{
4-
codes::*, Diag, DiagArgValue, DiagCtxt, DiagnosticMessage, EmissionGuarantee, IntoDiagnostic,
5-
Level,
4+
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, EmissionGuarantee, IntoDiagnostic, Level,
65
};
76
use rustc_hir::ConstContext;
87
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@@ -424,7 +423,7 @@ pub struct UndefinedBehavior {
424423

425424
pub trait ReportErrorExt {
426425
/// Returns the diagnostic message for this error.
427-
fn diagnostic_message(&self) -> DiagnosticMessage;
426+
fn diagnostic_message(&self) -> DiagMessage;
428427
fn add_args<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>);
429428

430429
fn debug(self) -> String
@@ -433,7 +432,7 @@ pub trait ReportErrorExt {
433432
{
434433
ty::tls::with(move |tcx| {
435434
let dcx = tcx.dcx();
436-
let mut diag = dcx.struct_allow(DiagnosticMessage::Str(String::new().into()));
435+
let mut diag = dcx.struct_allow(DiagMessage::Str(String::new().into()));
437436
let message = self.diagnostic_message();
438437
self.add_args(&mut diag);
439438
let s = dcx.eagerly_translate_to_string(message, diag.args.iter());
@@ -457,7 +456,7 @@ fn bad_pointer_message(msg: CheckInAllocMsg, dcx: &DiagCtxt) -> String {
457456
}
458457

459458
impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
460-
fn diagnostic_message(&self) -> DiagnosticMessage {
459+
fn diagnostic_message(&self) -> DiagMessage {
461460
use crate::fluent_generated::*;
462461
use UndefinedBehaviorInfo::*;
463462
match self {
@@ -595,7 +594,7 @@ impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
595594
}
596595

597596
impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
598-
fn diagnostic_message(&self) -> DiagnosticMessage {
597+
fn diagnostic_message(&self) -> DiagMessage {
599598
use crate::fluent_generated::*;
600599
use rustc_middle::mir::interpret::ValidationErrorKind::*;
601600
match self.kind {
@@ -783,7 +782,7 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
783782
}
784783

785784
impl ReportErrorExt for UnsupportedOpInfo {
786-
fn diagnostic_message(&self) -> DiagnosticMessage {
785+
fn diagnostic_message(&self) -> DiagMessage {
787786
use crate::fluent_generated::*;
788787
match self {
789788
UnsupportedOpInfo::Unsupported(s) => s.clone().into(),
@@ -819,7 +818,7 @@ impl ReportErrorExt for UnsupportedOpInfo {
819818
}
820819

821820
impl<'tcx> ReportErrorExt for InterpError<'tcx> {
822-
fn diagnostic_message(&self) -> DiagnosticMessage {
821+
fn diagnostic_message(&self) -> DiagMessage {
823822
match self {
824823
InterpError::UndefinedBehavior(ub) => ub.diagnostic_message(),
825824
InterpError::Unsupported(e) => e.diagnostic_message(),
@@ -842,7 +841,7 @@ impl<'tcx> ReportErrorExt for InterpError<'tcx> {
842841
}
843842

844843
impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
845-
fn diagnostic_message(&self) -> DiagnosticMessage {
844+
fn diagnostic_message(&self) -> DiagMessage {
846845
use crate::fluent_generated::*;
847846
match self {
848847
InvalidProgramInfo::TooGeneric => const_eval_too_generic,
@@ -877,7 +876,7 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
877876
}
878877

879878
impl ReportErrorExt for ResourceExhaustionInfo {
880-
fn diagnostic_message(&self) -> DiagnosticMessage {
879+
fn diagnostic_message(&self) -> DiagMessage {
881880
use crate::fluent_generated::*;
882881
match self {
883882
ResourceExhaustionInfo::StackFrameLimitReached => const_eval_stack_frame_limit_reached,

0 commit comments

Comments
 (0)