From 899cb40809a85eb9d89f6da3268713b83175360a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 23 Feb 2024 10:20:45 +1100 Subject: Rename `DiagnosticBuilder` as `Diag`. Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy. --- compiler/rustc_mir_build/src/errors.rs | 17 +++++++---------- .../rustc_mir_build/src/thir/pattern/check_match.rs | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'compiler/rustc_mir_build/src') diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 101f1cb9f2f..95e69acbf23 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -1,8 +1,8 @@ use crate::fluent_generated as fluent; use rustc_errors::DiagnosticArgValue; use rustc_errors::{ - codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, - IntoDiagnostic, Level, MultiSpan, SubdiagnosticMessageOp, + codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, + Level, MultiSpan, SubdiagnosticMessageOp, }; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_middle::ty::{self, Ty}; @@ -422,7 +422,7 @@ pub struct UnsafeNotInheritedLintNote { impl AddToDiagnostic for UnsafeNotInheritedLintNote { fn add_to_diagnostic_with>( self, - diag: &mut DiagnosticBuilder<'_, G>, + diag: &mut Diag<'_, G>, _f: F, ) { diag.span_note(self.signature_span, fluent::mir_build_unsafe_fn_safe_body); @@ -464,12 +464,9 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> { - let mut diag = DiagnosticBuilder::new( - dcx, - level, - fluent::mir_build_non_exhaustive_patterns_type_not_empty, - ); + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'_, G> { + let mut diag = + Diag::new(dcx, level, fluent::mir_build_non_exhaustive_patterns_type_not_empty); diag.span(self.span); diag.code(E0004); let peeled_ty = self.ty.peel_refs(); @@ -873,7 +870,7 @@ pub struct Variant { impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> { fn add_to_diagnostic_with>( self, - diag: &mut DiagnosticBuilder<'_, G>, + diag: &mut Diag<'_, G>, _f: F, ) { diag.arg("ty", self.ty); diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index a0235f20a05..cf12b4fb912 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -11,7 +11,7 @@ use rustc_ast::Mutability; use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{ - codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, + codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, }; use rustc_hir as hir; use rustc_hir::def::*; @@ -64,7 +64,7 @@ pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), Err visitor.error } -fn create_e0004(sess: &Session, sp: Span, error_message: String) -> DiagnosticBuilder<'_> { +fn create_e0004(sess: &Session, sp: Span, error_message: String) -> Diag<'_> { struct_span_code_err!(sess.dcx(), sp, E0004, "{}", &error_message) } -- cgit 1.4.1-3-g733a5